I’m getting really frustrated as I’m trying to get an array to my _Click-Event in my ASP.NET-Application.
Here’s the thing:
I have an dynamicly created “form”, which is a todolist.
So for every todo, I have an description (from the database), a note-field and a checkbox.
Since their could be 0-n todos, I can’t work with the asp:-Tag in the ascx-File.
That’s why I created an class for each todo, which looks like this:
private class todoContainer
{
public int? id
{
get;
set;
}
public CheckBox activeted
{
get;
set;
}
[...]
The list gets created with an foreach-loop and every toDo goes into the array “todoArray”.
Here’s how I work with the Controls inide the loop:
checkboxArea.Controls.Add(todoArray[todoArrayInt].activeted);
Since I now want to send the list to the submit-event with all the changes I made (for examples if I want to add a note to toDo X and want to cross off toDo Y), I have to get the whole array in my _Click-method.
Unfortunately I can’t find a way to accomplish this…
I tried this:
- Get the whole array into an asp:HiddenField-Controll, which doesn’t work at all
- Get the array into a session, but than I can’t find a way how to track changes…
If anybody could help me, I would be realy thankfull.
Best regards
Richard
how about using a asp:repeater control?
on your submit button click event you should be able to loop through every item in your asp:repeater