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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Get selected row value based on checkbox selected in gridview using jquery

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
Hi ,    i am having gridview with two columns.one column contains checkboxes and another column contains Name.i have given UserId to DataKeyNames in gridview.Now i will check some checkboxes in gridview and click on button GetData. whenver i click on button GetData i need to get datakey values of all the gridview rows whatever checked in gridview using JQUERYPlease help me i am new to JQUery

View Complete Post

More Related Resource Links

how to get the text of selected checkbox from asp.net checkboxlist control using jquery


I have asp.net checkboxlist control that bounded to a data source so the number of items in the control are different from one to to another time.

I have this function:

     $('#<%=chkListGroups.ClientID %> input:checkbox:checked').siblings('label').text();

this function will return all texts for all selected items in the control as a one string.

 I'm looking for a way that when I check a check box from the ckeckboxlist control will return only last checked checkbox.

this code :

$('#<%=chkListGroups.ClientID %> input:checkbox:checked').last().siblings('label').text(); 

returns last checked item for example if I checked second will return
second item then when I checked fifth item will return fifth item but
if now when I check third item will return fifth item so it is always
returning last item checked in the list and I'm looking to

Please advice me how to do this using jquery.

How to Context Menu when i right click on Gridview selected Row using Jquery



I have a requirement that

When i select a row in Gridview,it will High light the row and when Right click on selected

Row,It will open Context Menu.

In that menu i want to do Add new row delete row etc.

Help me in that.


Rama krishna.

Listview/gridview checkbox is selected or not



I have a question about checkbox in listview or checkbox. How do I know when checkbox is selected or not? Do I have to add Binding or..

Import-Module wpk
Add-Type -AssemblyName presentationframework

[xml] $xaml = @"
  Title="MainWindow" Height="350" Width="525">
    <ListView Grid.Row="0" Grid.Column="1" Grid.RowSpan="3" Margin="3" Name="ListView1" SelectionMode="Extended">
 <GridView AllowsColumnReorder="true">
 <GridViewColumn Header="ServerName">               
      <CheckBox Margin="-4,0,-4,0" IsChecked="False" Name="nupp" Content="{Binding ServerName}"/> 

Enable TextBox in GridView when CheckBox is Selected


Hi Friends,

There is small exercise, I want to enable TextBox when the CheckBox of same row in GridView is Selected. Right now I’m doing this by using Javascript.

In my GridView

1st Column is : Checkboxes

2nd Column is : First Name

3rd Column is : TextBoxes (which is to be enabled)

And RollNo field Column is hidden.

Here is my code –

<script type="text/javascript">

        function selectAll(invoker)


            var inputElements = document.getElementsByTagName('input');

            for (var i = 0 ; i < inputElements.length ; i++)


                var myElement = inputElements[i];               

                if (myElement.type === "checkbox")


jQuery: Highlight Gridview Rows with Checkbox

Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

Gridview setup:

jQuery: Highlight Gridview Rows with Checkbox

Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

Gridview that exports selected rows to Excel

his seems like a messy workaround, but I ended up using two Gridviews - one to display my data and show my checkboxes, and the other which was invisible amd would eventually end up as my Excel spreadsheet.

How to let user edit selected gridview columns, not entire row



I've got a gridview I would like to let the user edit a couple of columns.  Seems like everything I'm coming across so far makes the entire row editable.  

Hopefully the solution isn't too complicated.  Can someone point me in the right direction?


Rendering data with HTML tags in the DD Gridview for a selected column


I am having trouble finding out where and how to HTML Encode a cell's data on the Dynamic Data (v4.0) gridview of List.aspx.  As a simple case, suppose I have formatted cell data that is A<br/>B in the DB.    Obviously, I want A stacked on B in the cell.

It seems gridView1.HtmlEncode = true has gone away.

So maybe I'll try to catch it on the RowDataBound event:

protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)

            if (e.Row.RowType == DataControlRowType.DataRow)
                // Html Encode the cells


but this event never fires?

Has anyone figured out how to properly render HTML tags data in the List.aspx's GridView1? 

If I figure this out, then I can add a MetaAttribute called something like [EncodeAsHtml(true)] and be on my way.  Thanks!

jquery autocomplete selected value



Iam using jquery autocomplete to search data and i have button to get the detail value of employee and

display in label , what i need is that , i don't want to put button to get detail , instead i need to select the from\

auto search and press enter key  and show the detail in the lablel example(empname,address, emailid).

Looking forward valuable suggestions

Gridview Selected Value is Not a Primary Key

Hello,  I have 2 GridViews.  One is working perfectly.  What I would like to have happen is when a row is selected on GridView1 (with Primary key of OrderNumber), the matching records from the field in GridView1 ClientID to show up in GridView2. <asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="\\sjfileserver\data\database\S.J. Rollins Technologies Information Center.mdb" SelectCommand="SELECT [ClientID], [OrderNumber], [Field1] FROM [ORDERS] WHERE ([ClientID] = ?)"> <SelectParameters> <asp:ControlParameter ControlID="GridView1" Name="ClientID" PropertyName="SelectedValue" Type="Int32" /> </SelectParameters> </asp:AccessDataSource> <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="CustomerID" DataSourceID="AccessDataSource2"> <Columns> <asp:BoundField DataField="CustomerID" HeaderText="ClientID" SortExpression="ClientID" /> <asp:BoundField DataField="OrderNumber" HeaderText="OrderNumber"

Selected Value in Gridview not Accessable via SelectedIndex

I'm trying to keep these questions seperate for people searching after me, so sorry if there is so many.I have the following code on SelectedIndexChange of GridView1HFCustomerID.Value = GridView1.Rows(GridView1.SelectedIndex).Cells(6).Text.ToString()I have a drop down list that you can choose values from, and depending on which item you pick GridView1 changes, this all works correctly, and if I select one of the rows the SelectedIndex changes.  My problem occurs when you choose a different value from the drop down list, GridView1 Changes accordingly, and by default a record is selected.  But selectedindexchange is never fired again until I manually select another record from the gridview which is a problem.Any Ideas?  Am I putting this code in the incorrect place?

Inserting Records Based on Checkbox Selection in a Gridview

Using checkboxes, can the row of record(s) be inserted into a database? I am populating a Gridview. Done. A checkbox field has been added, when the user selects one or more rows, a submit button (which is not working) needs to inserting those records into a table. The insert statment will work outside of the page but is not working using the scenario I jut described. Is this task as I have outlined doable? txs Ayomide

How to get row value when a row is selected or clicked in gridview

Hello, I have a gird view,which has only one field displayed,and a text box. (Grid view has 2 data rows.) On the gridview i have a button field named "Detailed View" which has command name "Detailed". When i click on the row 1 i wanted to display the value on the text box How will I execute it? I have given the following code but its not giving me the expected result.textbox1.Text = datagrid.Rows(e.CommandArgument).Cells(0).Text) and on the gridviews _RowCommand event Its showing null I am using VS 2008 (.net version 3.5) AND MS ACESS DB In visual studio 2005(.net 2.0) the same code is working absolutely fine ThanksNick

jQuery instead of UpdatePanel (repeater loads when item in dropdown is selected)

Hello!I want to develop web page on which most of the things happens on clientside. The page contains several tabs (jQuery). One tabbed section have repeater which load when item in dropdown is selected.I've placed this 2 controls in UpdatePanel. Does somebody have any example how to achieve this without UpdatePanel, with jQuery?  I've heard that UpdatePanels are bad for page performance. I'm very new to jQ and Ajax.Thanks!all the bestBlaz

Print a specific Access Report with selected GridView record

I have my code output a gridview with all the data with an option to select records. I'm trying to make a code which would allow me to select a record, and then print this record using a specific Report stored in MS Access. I've located the code to print the Report it self, but it prints ether all the records or a range. Any ideas? 

get the ddl selected value using jquery


salam to all,

i tried manytimes to get the selected value for a dropdownlist using jquery, but i failed!!

when i put the following code to get the text i get it successfully,

        var ResultValue = $('#<%= ResultDropDownList.ClientID %> :selected').text();

but when i try :

        var ResultValue = $('#<%= ResultDropDownList.ClientID %> :selected').value;

i am not !!!

what is the problem here?

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