Home All Groups Group Topic Archive Search About

GridView Dynamically Inserted Template with RadioButton

Author
26 Feb 2007 9:43 PM
gauty
Hi All,

I have an ASP.NET 2.0 VB.NET application with a GridView in which I
insert a Template column at run time, using an approach similar to
that documented here (http://www.developer.com/net/asp/article.php/
3609991).

The Template contains a RadioButton (and I've got round all the
grouping issues this involves using a JavaScript workaround). I need
the RadioButton to have AutoPostback=True, so that I can respond to it
and change a database record accordingly. My problem is that I have to
respond to the RadioButton's CheckedChanged event, but I can't figure
out where to set the AddHandler code - I've tried in the class that
creates the RadioButton in the Template, and in the page containing
the GridView, but neither one leads to a successful capture of the
event.

Has anyone had a similar problem and - this is driving me crazy and
wasting a lot of valuable time??

TIA

Graham

Author
29 Apr 2010 10:27 AM
Kashish Malhotra
Try adding the handler in RowDataBound or RowCreated events of the gridview where you are adding the radiobutton to the gridview cell.



gauty wrote:

GridView Dynamically Inserted Template with RadioButton
26-Feb-07

Hi All, I have an ASP.NET 2.0 VB.NET application with a GridView in which I insert a Template column at run time, using an approach similar to that documented here (http://www.developer.com/net/asp/article.php/ 3609991). The Template contains a RadioButton (and I've got round all the grouping issues this involves using a JavaScript workaround). I need the RadioButton to have AutoPostback=True, so that I can respond to it and change a database record accordingly. My problem is that I have to respond to the RadioButton's CheckedChanged event, but I can't figure out where to set the AddHandler code - I've tried in the class that creates the RadioButton in the Template, and in the page containing the GridView, but neither one leads to a successful capture of the event. Has anyone had a similar problem and - this is driving me crazy and wasting a lot of valuable time?? TIA Graham

Previous Posts In This Thread:

On Monday, February 26, 2007 4:43 PM
gauty wrote:

GridView Dynamically Inserted Template with RadioButton
Hi All, I have an ASP.NET 2.0 VB.NET application with a GridView in which I insert a Template column at run time, using an approach similar to that documented here (http://www.developer.com/net/asp/article.php/ 3609991). The Template contains a RadioButton (and I've got round all the grouping issues this involves using a JavaScript workaround). I need the RadioButton to have AutoPostback=True, so that I can respond to it and change a database record accordingly. My problem is that I have to respond to the RadioButton's CheckedChanged event, but I can't figure out where to set the AddHandler code - I've tried in the class that creates the RadioButton in the Template, and in the page containing the GridView, but neither one leads to a successful capture of the event. Has anyone had a similar problem and - this is driving me crazy and wasting a lot of valuable time?? TIA Graham


Submitted via EggHeadCafe - Software Developer Portal of Choice
Get Silverlight 4 Installed: Tips and Tricks
http://www.eggheadcafe.com/tutorials/aspnet/05910e41-3846-4db9-8e1b-f54c56a64ed9/get-silverlight-4-install.aspx