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

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

GridView checkboxes problem

Posted By: pooja     Posted Date: April 09, 2010    Points:2   Category :ASP.Net
Hi frnds..

i have a gridview which is binded to a table in the database.
it has columns like Name,ID,City and EMail
i have chekboxes for selecting all rows and unselect.

i used javascript for selecting all and unselect

i used the follwoing code for that..

function selectAll(invoker)
// Since ASP.NET checkboxes are really HTML input elements
// let's get all the inputs
var inputElements = document.getElementsByTagName('input');

for (var i = 0 ; i < inputElements.length ; i++) {
var myElement = inputElements[i];

// Filter through the input types looking for checkboxes
if (myElement.type === "checkbox") {

// Use the invoker (our calling element) as the reference
// for our checkbox status
myElement.checked = invoker.checked;

. its working fine for that...

i want to javascript code for single row select.

but if i select any single row then the the EMail of that row must be displayed in the label...

i want only javascriot....

thanx in advabce

Author: Venkat             
Posted Date: April 12, 2010     Points: 5   


<asp:CheckBox ID="ChkboxPMSelAll" runat="Server" OnClick="CheckTest('ChkboxPM',this.checked,formName)" /></HeaderTemplate>
<asp:CheckBox ID="ChkboxPM" runat="Server" />

function CheckTest (chkD,v,formname)
for (var i=0;i<document.forms[formname].length;i++)
if (e.type.indexOf('checkbox')!= -1 && e.name.indexOf(chkD) != -1 )


Mark As Answer if this solve your problem
Warm Regards,

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

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