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! 7 2390
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!
"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
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.
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.
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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....
|
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...
|
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...
|
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...
|
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....
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
| |