![]() |
Add control to datagrid
Folks,
I'm trying to programaly add a RadioButton to my datagrid using this code bellow. When I run the aspx page the RadioButton apears, but when I click on it, it did not fire the sub "myRadioButton_Click" as designed bellow... Any ideas? Thanks, Luiz ------ Dim _item As DataGridItem Dim myRadioButton As New RadioButton _item = MyDataGrid.Items(1) myRadioButton.EnableViewState = True myRadioButton.ID = "RadioButton1" myRadioButton.GroupName = "RadioGroup1" myRadioButton.Text = "Alternatives" AddHandler myRadioButton.CheckedChanged, AddressOf myRadioButton_Click _item.Cells(2).Controls.Add(myRadioButton) |
Re: Add control to datagrid
Hi Luiz,
Don't forget to set autopostback=true myRadioButton.AutoPostBack = True Was that it? Ken Microsoft MVP [ASP.NET] "Luiz Vianna" <lvianna@multconnect.com.br> wrote in message news:e5D09zn9EHA.2452@TK2MSFTNGP14.phx.gbl... Folks, I'm trying to programaly add a RadioButton to my datagrid using this code bellow. When I run the aspx page the RadioButton apears, but when I click on it, it did not fire the sub "myRadioButton_Click" as designed bellow... Any ideas? Thanks, Luiz ------ Dim _item As DataGridItem Dim myRadioButton As New RadioButton _item = MyDataGrid.Items(1) myRadioButton.EnableViewState = True myRadioButton.ID = "RadioButton1" myRadioButton.GroupName = "RadioGroup1" myRadioButton.Text = "Alternatives" AddHandler myRadioButton.CheckedChanged, AddressOf myRadioButton_Click _item.Cells(2).Controls.Add(myRadioButton) |
Re: Add control to datagrid
OK Ken,
that's what it was missing.... Thanks Luiz "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@sympatico.ca> escreveu na mensagem news:eSU7d0r9EHA.208@TK2MSFTNGP12.phx.gbl... > Hi Luiz, > > Don't forget to set autopostback=true > > myRadioButton.AutoPostBack = True > > Was that it? > > Ken > Microsoft MVP [ASP.NET] > > > "Luiz Vianna" <lvianna@multconnect.com.br> wrote in message > news:e5D09zn9EHA.2452@TK2MSFTNGP14.phx.gbl... > Folks, > > I'm trying to programaly add a RadioButton to my datagrid using this code > bellow. > > When I run the aspx page the RadioButton apears, but when I click on it, it > did not fire > the sub "myRadioButton_Click" as designed bellow... > > Any ideas? > > Thanks, > > Luiz > > ------ > > Dim _item As DataGridItem > Dim myRadioButton As New RadioButton > > _item = MyDataGrid.Items(1) > > myRadioButton.EnableViewState = True > myRadioButton.ID = "RadioButton1" > myRadioButton.GroupName = "RadioGroup1" > myRadioButton.Text = "Alternatives" > > AddHandler myRadioButton.CheckedChanged, AddressOf myRadioButton_Click > > _item.Cells(2).Controls.Add(myRadioButton) > |
| All times are GMT. The time now is 01:51 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.