|
-
May 20th, 2005, 08:19 AM
#1
Thread Starter
Member
Datagrid binding
Hi hoping someone can point me in the right direction.
I am using a datagrid on my webpage which contains a checkbox in col1, a list of subjects in col2 (which have been pulled from a database table) and a dropdownlist in col3. This displays as expected. What I do want is for someone to choose subjects by checking the appropriate checkbox in col1 then using the dropdown for more info in col3. I then need to save which rows were chosen in another table based on userid.
The difficulty i am having is that on the second visit to the page i want the same list of subjects populating the datagrid rows to be visible but i want the subjects that the user previously chose to have the checkbox checked adn the dropdown showing the correct value.
Therefore is it possible to bind the datagrid to one sql table and then use values from another sql table to check off rows or am i going about this in the wrong way.
-
May 20th, 2005, 12:49 PM
#2
I wonder how many charact
Re: Datagrid binding
You can certainly do so. When you bind a datagrid, it is only bound during the current request - it uses the binding methods to dynamically add controls to the datagrid which are then henceforth preserved via viewstate - the datasource or any data contained within it are lost. The datagrid has no tie to the datasource at all - contrary to a fat windows application, it just appears that way. The illusion is held intact thanks to viewstate remembering the values of the controls that were added to the datagrid (which is really just a sophisticated version of a panel or other container control). You can test this by adding enableViewState="false" to the datagrid tag, and you will easily see you have no more 'data' in the grid.
-
May 20th, 2005, 12:59 PM
#3
Thread Starter
Member
Re: Datagrid binding
thank you -i had not long figured out how exactly to write this. I basically fill the datagrid first with the initial table details. Then i pull of the specific user details put them into a datareader, loop through them and then when they match a value in the datagrid i check that row and update all the other dropdowns, text boxes etc with the new values.
can say that this is now resolved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|