Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > dynamic checkbox

Reply
Thread Tools

dynamic checkbox

 
 
James Wong
Guest
Posts: n/a
 
      12-13-2006
Dear Sir,

I want to create some dynamic checkbox controls into the table.
How can I get these controls after the form is submitted.
-----------------------------------------------------
e.g.
For i = 1 to 9
trwRow = New TableRow
chkCheckBox = New CheckBox
chkCheckBox.ID = "c" + CStr(i)
tclCell = New TableCell
tclCell.Controls.Add(chkCheckBox)
trwRow.Cells.Add(tclCell)
Next
-----------------------------------------------------
Thanks!

James



 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFuaXNoIEJhZm5h?=
Guest
Posts: n/a
 
      12-13-2006
Hi,

How about this code:

for (int i = 0; i < 9; i++)
{
TableRow tr = new TableRow();
TableCell tc = new TableCell();
CheckBox chkCheckBox = new CheckBox

chkCheckBox .Attributes.Add("runat", "Server");
chkCheckBox .EnableViewState = true;
chkCheckBox .ID = "chkCheckBox " + i;

tc.Controls.Add(chkCheckBox );
tr.Cells.Add(tc);
table.Rows.Add(tr);
}

Thanks and Regards,
manish bafna

"James Wong" wrote:

> Dear Sir,
>
> I want to create some dynamic checkbox controls into the table.
> How can I get these controls after the form is submitted.
> -----------------------------------------------------
> e.g.
> For i = 1 to 9
> trwRow = New TableRow
> chkCheckBox = New CheckBox
> chkCheckBox.ID = "c" + CStr(i)
> tclCell = New TableCell
> tclCell.Controls.Add(chkCheckBox)
> trwRow.Cells.Add(tclCell)
> Next
> -----------------------------------------------------
> Thanks!
>
> James
>
>
>
>

 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      12-13-2006
James,

You have to recreate dynamically created controls on every postback.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


"James Wong" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Dear Sir,
>
> I want to create some dynamic checkbox controls into the table.
> How can I get these controls after the form is submitted.
> -----------------------------------------------------
> e.g.
> For i = 1 to 9
> trwRow = New TableRow
> chkCheckBox = New CheckBox
> chkCheckBox.ID = "c" + CStr(i)
> tclCell = New TableCell
> tclCell.Controls.Add(chkCheckBox)
> trwRow.Cells.Add(tclCell)
> Next
> -----------------------------------------------------
> Thanks!
>
> James
>
>
>



 
Reply With Quote
 
James Wong
Guest
Posts: n/a
 
      12-13-2006
Dear Eliyahu Goldin,

Thanks a lot.

James


"Eliyahu Goldin" <(E-Mail Removed)> glsD:(E-Mail Removed) bl...
> James,
>
> You have to recreate dynamically created controls on every postback.
>
> --
> Eliyahu Goldin,
> Software Developer & Consultant
> Microsoft MVP [ASP.NET]
>
>
> "James Wong" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Dear Sir,
>>
>> I want to create some dynamic checkbox controls into the table.
>> How can I get these controls after the form is submitted.
>> -----------------------------------------------------
>> e.g.
>> For i = 1 to 9
>> trwRow = New TableRow
>> chkCheckBox = New CheckBox
>> chkCheckBox.ID = "c" + CStr(i)
>> tclCell = New TableCell
>> tclCell.Controls.Add(chkCheckBox)
>> trwRow.Cells.Add(tclCell)
>> Next
>> -----------------------------------------------------
>> Thanks!
>>
>> James
>>
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid and embeded Checkbox..How to find if checkbox clicked =?Utf-8?B?RG90TmV0RGV2?= ASP .Net 1 10-06-2006 04:11 PM
disable checkbox list checkbox Vikram ASP .Net 1 01-25-2006 02:59 PM
Text on Checkbox below the checkbox tshad ASP .Net 0 04-14-2005 11:26 PM
A nested dynamic checkbox inside my dynamic form. pizzy Javascript 5 04-12-2005 02:55 PM
How to have a nested dynamic checkbox inside my dynamic form. pizzy Javascript 0 03-23-2005 03:32 AM



Advertisments