Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datagrid checkbox javascript

Status
Not open for further replies.

vcllvc

Programmer
Jul 12, 2001
136
US
I have a datagrid, each row contains 4 checkboxes columns and 2 text columns (customer type and customer name).
I need to use javascript to do some validation on the checkboxes.
The validation is when a checkbox is checked, then base on the customer type of that row, and go through all the rows and if find a customer type is same, uncheck all the checkbox on that found row.
If customer type is different, ignore it.

The restriction is I have to use javascript to do the job.

Afterward, I will need to retrive all checkboxes status during a postback.

I tried to modify the ID on each checkbox during databound event, but I cannot get the updated checkboxes status.

Hope someone can help.

Thanks in advance.
 
With either a datagrid or a gridview, asp.net has a way to name controls within the grid. It is in a format like somename_ControlID. For exmaple, in my gridview, the control FirstName may get a ID as "ctl0_ContentPlaceHolder1_gvClient__ctl3_FirstName" when the dataview is in the Edit mode. All controls in the row have the same header name as "ctl0_ContentPlaceHolder1_gvClient__ctl3_".

What I usually do is to have a javascript code to get the header name from the "this" object that calls the javsacript procedure. Then the code can manipulate other controls in the row.

Hope this helps.

Seaport
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top