Asp net gridview rowupdating dropdownlist Nigeria sexchat

The data comes from the DB and I am using LIST Code Behind Page protected void Grid View1_Row Data Bound(object sender, Grid View Row Event Args e) { if (e. You will need to get the vehicle id for the current row and set the selectedvalue to that. If you are not including the key in the row and you have the Data Key Names property of the gridview set then you could use that to get the key Hi Cherryhomesj, Here is my code and aspx page, I really don't understand what is going on.

NET page with Gridview(with EDIT and Delete functionlity) and dropdownlist inside it, the Dropdownlist is well populated with the correct values but whenever I click EDIT button in the gridview the selected value in Drop Downlist is set to the wrong value(to the first item in the collection) . Additional info: when I put the code in line 33 ddl. Data Value Field; This is the Error I get 'ddl Vehicle Nr' has a Selected Value which is invalid because it does not exist in the list of items. Second, right now your telling it to set it's selected value to the string "Vehicle ID" instead of an actual vehicle id. Find Control("ddl State") as Drop Down List; // Get the drop down list if (ddl. Count You might need to use a different cell index and control index to get the primary key for your row depending on which column it's in.

control's built-in advanced functionality to add a drop-down list to the editing display.

This can be done on a Web form without having to write any code behind the form.

you need to use its selected value property, dropdown list is collection of values, but you are assigning a scalar value to your update statements.

w=800" src=" w=800&h=359" alt="Debugger Inside Grid View Row Updating Event" width="800" height="359" class="size-full wp-image-328" srcset=" w=230" src=" w=800" alt="Grid View on Browser" class="size-full wp-image-335" srcset=", w=416" src=" w=800" alt="Grid View Cell Showing Updated Value" class="size-full wp-image-331" srcset=",

If we move our mouse on to the variables, which hold the cell values, we can see the old value instead of new updated value (Refer the debugging Screen Shot at the Top).

Tasks illustrated in this walkthrough include the following: Although this walkthrough shows how to display a drop-down list populated with values from the same column as the one bound to the control, there are many alternate methods for populating a drop-down list.

Now you can ask questions directly to me on my new site ASPForums.

Leave a Reply