Avatar of brgdotnet
brgdotnet
Flag for United States of America asked on

how to reference the id of my checkbox in a dynamic GridView control

In my C# code I am creating a dynamic GridView control and one of the columns is a check box. In my C# code I am also assigning an ID to my
check box control in my RowDataBound event.  ===>   chkBox.ID = "CheckBox" + e.Row.RowIndex


However when my page is rendered, the id of the checkbox is prepended with the text "MainContent_myGrid_"  and appended by and underscore and then the number.
Example

<input id = "MainContent_myGrid_CheckBox3_3" type="checkBox" name="ctl00$MainContent$myGrid$ct103>


I want to be able to disable the checkbox using Java script.How can I reference the check box control by the ID I assigned to it in the GridView control?
Is there a way to do it, without having to reference the prepended "MainContent_myGrid_" text and the appended text of underscore followed by the number
of the check box?
ASP.NET

Avatar of undefined
Last Comment
Prakash Samariya

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Nitin Sontakke

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Prakash Samariya

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy