Computing.Net > Forums > Web Development > checkbox within datagrid (ASP.NET)

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

checkbox within datagrid (ASP.NET)

Reply to Message Icon

Name: sthchris
Date: August 24, 2004 at 22:33:30 Pacific
OS: Win2Kserver
CPU/Ram: P4 2G/512MB
Comment:

Hi all,

It is an ASP.NET (vb) question regarding the checkboxes within a datagrid.

What I wanna to do is - when I check/uncheck a checkbox within the datagrid, it will call another function/procedure to do another thing. Can anybody please assist me in giving the appropriate coding to me?

Thanks in advance!



Sponsored Link
Ads by Google

Response Number 1
Name: SN
Date: August 24, 2004 at 22:59:54 Pacific
Reply:

Just make sure that the postback property (or maybe it's autopostback) is set to true for the checkbox (in the item template of the datagrid). Then point the onClick attribute of the checkbox to the function of your choice.

-SN


0

Response Number 2
Name: CraigStone
Date: September 2, 2004 at 12:16:23 Pacific
Reply:

I would like to modify the checkbox control's NAME attribute, in order to make it javascript-friendly? Any ideas would be greatly helpful. Right now, .net spits out a NAME attribute for the checkbox as "dgMyGrid:_ctl0:_chkMyCheckbox". Javascript will throw an error when you attempt to reference that checkbox (any of them) with that name. I would need to remove the colons (:) in order for javascript to accept the explicit reference. Microsoft has done this with their linkbuttons for example. They use dollar signs ($) and have the __doPostback javascript function split on the dollar signs and re-concatenate with colons before posting back to the server (triggered by clicking the linkbutton). Attempting to modify an attribute of a checkbox in a datagrid on the ItemDataBound event, results in a wrapping of a SPAN tag with the desired attribute and value inline with the tag. The checkbox's NAME attribute remains unchanged and the entire checkbox HTML markup is placed inside of this newly generated SPAN tag.

Any idea how to set/reference the checkbox NAME attribute in the datagrid on the ItemDataBound event?

Thanks in advance.

Craig


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: checkbox within datagrid (ASP.NET)

ASP.Net, dynamically create button www.computing.net/answers/webdevel/aspnet-dynamically-create-button-/1849.html

ASP.net DataGrid Display!!! Help! www.computing.net/answers/webdevel/aspnet-datagrid-display-help/1584.html

asp.net web service and mysql www.computing.net/answers/webdevel/aspnet-web-service-and-mysql-/2695.html