Problem with DataGrid, CheckBox and DropDownList

S

shiv

Hi all:

I need some help/clarification with the DataGrid control. Here is what I am trying to achieve:

I am populating a DataGrid after a user has made a selection in a dropdownlist. After the selection, the users clicks on the submit button and that populates the grid. A few of the columns are databound and I am adding 2 more columns [TemplateColumns to be precise], each with a checkbox, dropdownlist and a textbox. Now I want to have the functionality that users should click on a checkbox on any row and that would enable the dropdownlist. This needs to happen immediately and I guess I would need to have the autopostback property of the checkbox to be true. After the user has done all the updates i.e. checking the boxes, I want to update those rows to a table in my database (I wont be updating the same table, rather writing all the row / checkbox.checked info to a new table. The trouble I am having right now is that I cant seem to know / get the values of the checkboxes. I have read quite a few posts and I have some pieces of code, but to no success. Some posts say that this can be handled in the ItemCommand event whilst some say OnCheckedChanged. Which one is it, and how would you do it - the sample snippet doesnt have to elaborate or complete, but enough to guide me through. What I have been acheive so far is to populate the grid with the data and thats it. Also, its ok if i cant get the dropdown to enable, but at least if i can access the values of the checkbox would be helpful. If you need me to post my code, let me know and i will post it.

PS: I am doing this using C# code-behind.

thanks,
shiv.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top