Hy all,
I’m developing a web application and I’m trying to use a checkboxlist. I want that for each selected item in that checkboxlist to create a new row in a table.So if I have 5 items and i check 3, I want a table to appear with 3 rows and in each row the selected items.This is how i get what items are checked:
protected void Button1_Click(object sender, EventArgs e)
{
string str = string.Empty;
foreach (ListItem item in check.Items)
{
str += item.Value;
}
}
My question is: how can I create a table with the selected values?? I’m using c# in an asp.net application
You’ll need to recreate this table on every postback since it’s created dynamically.
http://weblogs.asp.net/infinitiesloop/archive/2006/08/30/TRULY-Understanding-Dynamic-Controls-_2800_Part-3_2900_.aspx
Here’s working sample code:
Codebehind:
The button-click handler need not even to create it when it’s created from page_load anyway.