473,394 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Checkboxes checked in runtime datagrid

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
7 2396
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: john | last post by:
I am using ASP.NET and I have a datagrid. One of the columns in my grid is all checkboxes. When the user clicks on a certain button on the page, which is not in the grid, I want to be able to...
2
by: Mortar | last post by:
i have a datagrid with a column of html checkboxes which are created dynamically. The id/name of the checkboxes comes from a value in the database. on a postback, i would like to get all the...
2
by: john | last post by:
I posted this question to comp.lang.javascript but didn't get a response, so I'll try here. I am using ASP.NET and I have a datagrid. One of the columns in my grid is all checkboxes. When the...
2
by: Mortar | last post by:
i have a datagrid with 2 columns. the 1st column contains an id which will be used by the database for the selected checkbox records. the 2nd column is a template column containing a server...
0
by: Peter Afonin | last post by:
Hello, I have 5 checkboxes in one record in the datagrid. When the user checks 5th checkbox (or, in my case, clicks the button - doesn't matter to me), all other checkboxes are checked as well....
4
by: Jim Bancroft | last post by:
Hi everyone, I'm using a DataGrid with TemplateColumns. My DataGrid is located in a cell of an asp:Table. I did this so it's positioned correctly onscreen. One of the DataGrid's...
6
by: arun.hallan | last post by:
Hi, I have a datagrid whose datasource is a datatable which is saved to viewstate on page_load. I also have a cached string which handles what is shown on the rowfilter of the dataview of...
7
by: rn5a | last post by:
The first column of a DataGrid has a CheckBox for all the rows. I want that when users check a CheckBox, the BackColor of that entire row in the DataGrid should change to a different color. To...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.