Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Add control to datagrid (http://www.velocityreviews.com/forums/t775162-add-control-to-datagrid.html)

Luiz Vianna 01-09-2005 06:56 PM

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)


Ken Cox [Microsoft MVP] 01-10-2005 02:36 AM

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)


Luiz Vianna 01-10-2005 09:01 PM

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:35 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.