Updating gridview checkbox

What I want to do is, after the selections are made and after the "OK" button is clicked I want to display the selected items of the checkboxlist seperated by commas, (ex, French, English, German) in the textbox which was the targetcontrol of the popupextender.I have the following code Frinavale, what you have replied to is exactly my question.The problem is when I click Update the value is always saved back to the database as a 0 (Because that is the database default when no value is supplied) Please help! But I still have the problem that when updating the Value from the checkbox does not seem to be getting through. I have checked my Update method associated with the Grid View and it seems to be fine. When dynamically binding to the Grid View, use the following code in the Row Editing event: Grid View gv = (Grid View)sender; gv. When the Update button is clicked the value of the checkbox is used to set the hidden field value that is send back to the database. I have tried to intercept the updating value from the Row Updating event but the checkbox value is not contained in the e. An Overview of Inserting, Updating, and Deleting examined using the Object Data Source to facilitate inserting, updating, and deleting with the Grid View, Details View, and Form View controls.Alternatively, the Sql Data Source can be used in place of the Object Data Source.I know for sure know that it has to be handled by a javascript function on the client side. " "How will I be able to find the checkboxlist so that I can retreive the selected items and pass on the info to the appropriate textbox of the edititem of Grid View?When I click the Edit button the checkbox becomes active and is checked depending on whether the data has a 0 or a 1. New Values[] seems to work for other edittemplate fields ok. New Values["webname"] = "randomvalue"; I think I want to be able to do this... @masterpass - The Toggle method works fine in checking or unchecking the Edit Template checkbox. Maybe it will help: It's actually fairly easy to get the info you want once you know the trick. Data Bind(); To populate the New Values collection, put the following code in the Row Updating event: Grid View gv = (Grid View)sender; for (int i = 0; i Thanks 13598, I don't quite understand what you code is does but I found a work around myself. One is a hidden field that containes 0 or 1 depending on the data and the other is a checkbox that we can also set depending on 0 or 1.

To S @13598 - My Item Template seems to work fine as it only has to display the data.

I have a gridview with an update capabilities - a textbox column (room Name), a dropdownlist(org ID), a dropdownlist(room Type ID),a checkbox column (dial Out), a checkbox column (dial In).

When I try to add another checkbox column, the sql database isn't updated properly with a 0/1 or false/true but with null.

As Figure 4 shows, when the page is visited through a browser a Delete button is included. Figure 4: Each Grid View Row Now Includes a Delete Button (Click to view full-size image) Upon clicking a Delete button, a postback occurs, the Grid View assigns the Figure 5 depicts this interaction graphically.

Refer back to the Examining the Events Associated with Inserting, Updating, and Deleting tutorial for a more detailed discussion on the chain of events associated with inserting, updating, and deleting from a data Web control.

Leave a Reply