.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
satyapriyanayak
SP
abhays
Sasi Prabhu
Post New Web Links

how do i use javascript to change values of controls inside a gridview

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :ASP.Net
 
i have 2 labels (lblRate,lblTotal) and a textbox (txtQuantity) in a itemtemplate of a gridview.I want to calculate the products of rate and quantity and show it in Total as the textbox loses focus...i cant use textchanged because i dont want the page to postback.How do i use javascript to achieve this??Please Help Urgently....<asp:TemplateField HeaderText="Rate">                <ItemTemplate>                    <asp:Label ID="lblRate" runat="server" Text='<%# Eval("Rate") %>' />                </ItemTemplate>            </asp:TemplateField> <asp:TemplateField HeaderText="Quantity">                <ItemTemplate>                    <asp:TextBox ID="txtQty" runat="server" />                </ItemTemplate>&


View Complete Post


More Related Resource Links

Accessing the different controls inside a GridView control

  
how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

Validating DropdownList Inside Gridview Using Javascript

  
hi All,      I have Gridview with Dropdownlist which contains data as {select,1,2,3} .Gridview contains multiple rows of data.Submit button is also on form but outside gridview. If any of the rows of gridview dropdownlist contain value as "Select" and click Submit button ,give message as "Please select value". I want to do this stuff using javascript. Thanks in advance.

How to get the values of controls placed inside the repeater

  
Hi friends.........         In my code i will get the controls dynamically according to the Family members count.Now i need to display the values of each control individually which are placed inside the repeater control.  plz plz go through my code then you can understand my situation.I want to get the values of txtMemberName,drpRelationship,txtDateofBirth as in my database(dataset) for each control.This is my code:.aspx page<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="familyDetails.aspx.cs" Inherits="UI.familyDetails" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server">    <title>Untitled Page</title></head><body>    <form id="form1" runat="server">    <div>    <asp:Button ID="btnGetFamilydetails" runat="server" Text="Family Details"             onclick="btnGetFamilydetails_Click" />          <asp:Repeater ID="repFamilyDetai

How to create templete controls inside a gridview at run time

  

i am creating a grid view at run time.now i want to create controls inside the gridview at run time itself,and how to Bind/Eval it.

plz help me


change the color of label control inside gridview

  

Hi i am saving color as a string in database 

i have a gridview control

 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowUpdating="Update_Schedule"
                    OnRowDeleting="Delete_Schedule" OnPageIndexChanging="OnPaging" OnRowEditing="Edit_Schedule"
                    OnRowCancelingEdit="CancelEdit" PageSize="10">
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:CheckBox ID="Todo" runat="server" AutoPostBack="true" Height="23px" OnCheckedChanged="CheckedChanged" />
                                <asp:HiddenField ID="hdn_ScheduleID" runat="server" Value='<%#Eval("ID") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:Label Text='<%# Eval("Title") %>' runat="server" ID="lbl1"></asp:Label>
                            </ItemTem

On GridView Click, populate other controls with column values

  

Hello team,

I have 5 controls on the page - textbox, radiobutton, listbox, checkbox, and any other one more. And i have a grid. The grid has 5 corresponding columns. I have to make the grid row clickable, and on the click, i have to populate my 5 controls with each of the corresponding grid column values.

Please let me know how can i make it. I know that i can make the grid clickable, by setting the e.row.attribute.add("OnClick", "javascript:return passValues();");. In this case, all the value passing will happen in javaScript. Is this the correct way? I have yet to try implementing this, not sure if there will be any issues.

Before that wanted to know if there is any other approach to achieve this. Please help!


Change selected row background color in gridview using javascript

  

hi frineds,

              i have a gridview with radio buttons in gridview i have chance to select only one item at a time in gridview like this

i need to change the row color of selected item in gridview with radio button using javascript if i select second row with radio button first row comes to normal condition now second row is in selected mode please help to write this functionality using javascript


editing gridview values to another pages controls

  

i have a gridview in one form showempdetails.aspx

and another form is to edit the value of selected row editempdetails.aspx

in this page i have textboxes and dropdowns.

im using querystring which is bringing empid

(eg: empid=1 should bind all other columns to my controls of editempdetails.aspx)

 

below code is of empedit.aspx this takes loginid to employees_add.aspx

grdEmployeesEdit.EditIndex = e.NewEditIndex;

        Label objEmp = (Label)grdEmployeesEdit.Rows[e.NewEditIndex].Cells[0].FindControl("lbl_loginid");
        string id = objEmp.Text.ToString();
        Response.Redirect("~/Employee/employees_add.aspx?loginid=" + id.ToString());
                
        grdEmployeesEdit.DataBind();

employees_add.aspx.cs i wrote below code

string qslogin = Request.QueryString["loginid"];
        qslogin=objEmployee.P_loginid;//objemployee is my business logic

here by using primary key i should pass all my values of previous selected

Passing two Values From GridView to Javascript

  

Hello,


In this datelastmodified is Datagrid Column Name. I m displaying that column value in DIV. Now, I want to display another column Value in that DIV. that column name is Document Type. May I know how to pass that value.

<script type="text/javascript">
    function onRecordSelect(DateLastModified)
    {
        var DocumentType;
        var date;
       
        for(var i=0; i<DateLastModified.length; i++)
        {
              var record = DateLastModified[i];
              date += record.DateLastModified;
         }
        
        var oDiv = document.getElementById("divSelectedRecords");
        oDiv.innerHTML =  date;
     }
    
    </script>  


Gridview Null all values , Javascript

  

I did following code in vb.aspx, how I do following code in Javascript script,

Gridview1.EmptyDataText = "Data Not Found !"
Gridview1.DataBind()
Thanks in advance.


How To Add calendar control inside a GridView

  
This article show hot to add calendar control inside a GridView with code in c#

Using ATLAS PopUp Control with Calendar inside the GridView Control

  
In this video tutorial Mohammad demonstrates how you can access the Calendar control which is displayed using the ATLAS PopUp control inside the GridView control.

RadioButton inside GridView, How to get it work as normal

  
Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!

Maintain HTML Radio Button Selection Inside GridView After Postback

  
Long time ago I wrote an article about getting the value of the selected RadioButtons inside the GridView control. The code did not addresssed the postback issue which means that the selected radio button was cleared after the postback occurs.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend