Asp net gridview rowupdating dropdownlist

In the meantime, I'll paraphrase for other readers: You need to check for postback (see comments above).

Edit: @Tim Schmelter should add his comment as an anwer.

Wherever you are binding your Grid View, in Page_Load for instance, you need to do this: On a slightly unrelated note, you can actually use the Grid View Update Event Args parameter that's passed to that method to grab the updated values (rather than using Find Control to get the Drop Down List, and then getting the values).

Thus, your Grid View re-binds, and you get default values in your Row Updating event (rather than what you selected).

In this article we create a Gridview from database and add some additional operations such a add, edit and delete data in the Grid View control.

In the previous article , we learned how to create a simple Grid View at runtime .

As it happens though the Row Command method is also called during Updating.

I had the same problem with a different solution, I had implemented custom paging on the Grid View with a custom pager, and in the process added the Row Command method, which was rebinding the grid with a new page index.

w=800" src="https://taditdash.files.wordpress.com/2014/06/debugger-inside-gridview-rowupdating-event.png? w=800&h=359" alt="Debugger Inside Grid View Row Updating Event" width="800" height="359" class="size-full wp-image-328" srcset="https://taditdash.files.wordpress.com/2014/06/debugger-inside-gridview-rowupdating-event.png? w=230" src="https://taditdash.files.wordpress.com/2014/06/gridview-on-browser.png? w=800" alt="Grid View on Browser" class="size-full wp-image-335" srcset="https://taditdash.files.wordpress.com/2014/06/230w, https://taditdash.files.wordpress.com/2014/06/gridview-on-browser.png? w=416" src="https://taditdash.files.wordpress.com/2014/06/gridview-cell-showing-updated-value.png? w=800" alt="Grid View Cell Showing Updated Value" class="size-full wp-image-331" srcset="https://taditdash.files.wordpress.com/2014/06/416w, https://taditdash.files.wordpress.com/2014/06/gridview-cell-showing-updated-value.png?

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).

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

Tags: , ,