By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,089 Members | 1,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,089 IT Pros & Developers. It's quick & easy.

Checkboxes checked in runtime datagrid

P: n/a
Hi All,
I have a complex problem. I have dropdownlists (usually 3-5) and the
user selects some value from these and for each value selected,
datagrids are shown to the user. I am creating the Datagrids
dynamically using a loop depending on the number of Dropdownlists. The
datagrids also have a checkbox template column. Now my problem is that
how can I access the values selected by the user from these
checkboxes. He checks one or more checkboxes for each of the datagrid.
I am assigning unique ids to datagrids while creation. When the page
postsback, the datagrid is reconstructed dynamically. Can I use
viewstate or something to get what the user selected before the
datagrid is re-built on postback.
Thanks!
Nov 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
If you need to maintain viewstate in dynamically-created controls, you might
want to look at this free control from Denis Bauer:

"ASP.NET gives a developer the opportunity to programmatically add controls
to a web form using ParentControl.Controls.Add(new Control());
However, these controls are not persisted in any way thus having to be
recreated for each subsequent request. "

http://www.denisbauer.com/ASPNETCont...aceholder.aspx
"DJ Dev" <ri*********@icn.siemens.com> wrote in message
news:11*************************@posting.google.co m...
Hi All,
I have a complex problem. I have dropdownlists (usually 3-5) and the
user selects some value from these and for each value selected,
datagrids are shown to the user. I am creating the Datagrids
dynamically using a loop depending on the number of Dropdownlists. The
datagrids also have a checkbox template column. Now my problem is that
how can I access the values selected by the user from these
checkboxes. He checks one or more checkboxes for each of the datagrid.
I am assigning unique ids to datagrids while creation. When the page
postsback, the datagrid is reconstructed dynamically. Can I use
viewstate or something to get what the user selected before the
datagrid is re-built on postback.
Thanks!


Nov 18 '05 #2

P: n/a
Jos
"DJ Dev" <ri*********@icn.siemens.com> wrote in message
news:11*************************@posting.google.co m...
Hi All,
I have a complex problem. I have dropdownlists (usually 3-5) and the
user selects some value from these and for each value selected,
datagrids are shown to the user. I am creating the Datagrids
dynamically using a loop depending on the number of Dropdownlists. The
datagrids also have a checkbox template column. Now my problem is that
how can I access the values selected by the user from these
checkboxes. He checks one or more checkboxes for each of the datagrid.
I am assigning unique ids to datagrids while creation. When the page
postsback, the datagrid is reconstructed dynamically. Can I use
viewstate or something to get what the user selected before the
datagrid is re-built on postback.
Thanks!


First, you need to reconstruct the datagrids in the same way as before
the postback (with the same id's) first. Then, automatically, you get
viewstate, and you can handle the user's selections.

After that, you reconstruct the datagrids once more, in whatever
way is appropriate for the new page.

--

Jos Branders
Nov 18 '05 #3

P: n/a
Thanks Jos. That is the problem. I construct the datagrid with the
same id's and in the same way. But I still dont see the user
selections. Do I have to save the user selection in view state or
something. I am really confused. I can provide sample code.
Thanks for the help.

"Jos" <jo***************@fastmail.fm> wrote in message news:<e7**************@TK2MSFTNGP10.phx.gbl>...
"DJ Dev" <ri*********@icn.siemens.com> wrote in message
news:11*************************@posting.google.co m...
Hi All,
I have a complex problem. I have dropdownlists (usually 3-5) and the
user selects some value from these and for each value selected,
datagrids are shown to the user. I am creating the Datagrids
dynamically using a loop depending on the number of Dropdownlists. The
datagrids also have a checkbox template column. Now my problem is that
how can I access the values selected by the user from these
checkboxes. He checks one or more checkboxes for each of the datagrid.
I am assigning unique ids to datagrids while creation. When the page
postsback, the datagrid is reconstructed dynamically. Can I use
viewstate or something to get what the user selected before the
datagrid is re-built on postback.
Thanks!


First, you need to reconstruct the datagrids in the same way as before
the postback (with the same id's) first. Then, automatically, you get
viewstate, and you can handle the user's selections.

After that, you reconstruct the datagrids once more, in whatever
way is appropriate for the new page.

Nov 18 '05 #4

P: n/a
You can see what I am doing here..

http://67.126.110.21:8080/Project1/Procsel.aspx

http://67.126.110.21:8080/Project1/codebehind.txt

Basically, the user selects something from dropdownlist, choose some
checkboxes and submits. In the submit event handler, I am re-creating
the datagrid, otherwise it wont show up. But when i do that I also
loose the checkboxes selected. how can i capture that before I
recreate the grid. I have also provided the code-behind. please note
that the dropdowns and data-grids are DYNAMIC and created at runtime.
Thanks for the help!
ri*********@icn.siemens.com (DJ Dev) wrote in message news:<11**************************@posting.google. com>...
Thanks Jos. That is the problem. I construct the datagrid with the
same id's and in the same way. But I still dont see the user
selections. Do I have to save the user selection in view state or
something. I am really confused. I can provide sample code.
Thanks for the help.

"Jos" <jo***************@fastmail.fm> wrote in message news:<e7**************@TK2MSFTNGP10.phx.gbl>...
"DJ Dev" <ri*********@icn.siemens.com> wrote in message
news:11*************************@posting.google.co m...
Hi All,
I have a complex problem. I have dropdownlists (usually 3-5) and the
user selects some value from these and for each value selected,
datagrids are shown to the user. I am creating the Datagrids
dynamically using a loop depending on the number of Dropdownlists. The
datagrids also have a checkbox template column. Now my problem is that
how can I access the values selected by the user from these
checkboxes. He checks one or more checkboxes for each of the datagrid.
I am assigning unique ids to datagrids while creation. When the page
postsback, the datagrid is reconstructed dynamically. Can I use
viewstate or something to get what the user selected before the
datagrid is re-built on postback.
Thanks!


First, you need to reconstruct the datagrids in the same way as before
the postback (with the same id's) first. Then, automatically, you get
viewstate, and you can handle the user's selections.

After that, you reconstruct the datagrids once more, in whatever
way is appropriate for the new page.

Nov 18 '05 #5

P: n/a
Jos
DJ Dev wrote:
You can see what I am doing here..

http://67.126.110.21:8080/Project1/Procsel.aspx

http://67.126.110.21:8080/Project1/codebehind.txt
These links don't seem to work.
Basically, the user selects something from dropdownlist, choose some
checkboxes and submits. In the submit event handler, I am re-creating
the datagrid, otherwise it wont show up.


Try recreating the datagrid in Page_Load or Page_Init.
In the submit event handler is too late, because viewstate is added before
that.

--

Jos Branders
Nov 18 '05 #6

P: n/a
Sorry for the inconvineance. The links are :

http://67.126.110.20:8080/Project1/Procsel.aspx

http://67.126.110.20:8080/Project1/codebehind.txt

These links do work. Thanks for the help!
"Jos" <jo***************@fastmail.fm> wrote in message news:<#C**************@TK2MSFTNGP11.phx.gbl>...
DJ Dev wrote:
You can see what I am doing here..

http://67.126.110.21:8080/Project1/Procsel.aspx

http://67.126.110.21:8080/Project1/codebehind.txt


These links don't seem to work.
Basically, the user selects something from dropdownlist, choose some
checkboxes and submits. In the submit event handler, I am re-creating
the datagrid, otherwise it wont show up.


Try recreating the datagrid in Page_Load or Page_Init.
In the submit event handler is too late, because viewstate is added before
that.

Nov 18 '05 #7

P: n/a
Any Help would be highly appreciated!
Thanks.

ri*********@icn.siemens.com (DJ Dev) wrote in message news:<11**************************@posting.google. com>...
Sorry for the inconvineance. The links are :

http://67.126.110.20:8080/Project1/Procsel.aspx

http://67.126.110.20:8080/Project1/codebehind.txt

These links do work. Thanks for the help!
"Jos" <jo***************@fastmail.fm> wrote in message news:<#C**************@TK2MSFTNGP11.phx.gbl>...
DJ Dev wrote:
You can see what I am doing here..

http://67.126.110.21:8080/Project1/Procsel.aspx

http://67.126.110.21:8080/Project1/codebehind.txt


These links don't seem to work.
Basically, the user selects something from dropdownlist, choose some
checkboxes and submits. In the submit event handler, I am re-creating
the datagrid, otherwise it wont show up.


Try recreating the datagrid in Page_Load or Page_Init.
In the submit event handler is too late, because viewstate is added before
that.

Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.