Retrieval of Checkbox value

5 replies. Last post: June 1, 2010 9:42 AM by Brad Loveall
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Brad LoveallMember

I'm having trouble retrieving the value of a checkbox in a WebGrid in both "Template" and "Checkbox" column scenarios. I have a checkbox that I don't want bound to any data; it exists as a flag that indicates that the user would like to save some data that is contained in the rows that they check. Then, I have a button on the page that, when clicked, is supposed to allow the retrieval of the checked rows. But, when I handle the click event and loop through the rows, I can't get the data. If I use a CheckBox column, the "Text" and "Value" properties are always "0" even if the CheckBox is checked. In "Template" column scenarios, when I try to find the CheckBox via "GetTemplate.FindControl("chk"), the control is not found.

So, what is the recommended way of accomplishing this? I want a CheckBox as the first column of each row and the user can select some rows and, when they click a button on the page, I want to retrieve the checked columns? There is probably just something small that I am missing.

Brad

All times are GMT -5. The time now is 11:56 PM.
Previous Next