Get datakey from gridview rowupdating

posted by | Leave a comment

How do I retrieve that value inside the Row Command event? Value; I'm aware that I could instead pass that ID as the Command Argument, but I chose to use Data Key to give me more flexibility.

This seems to work, but I don't like the cast to Link Button (what if some other command is firing the event? I'm also aware that it's possible to use a hidden field for the ID, but I consider that a hack that I don't want to use.

The trouble is that when the call for the Select Method of the formview goes to the relevant function - "Get Customer By Cusnum" I have a null value in its parameter "cusnum".

I know that I can write a selecting event and using Command Argument, parse the value of the selected row and pass it into the Select method as a value but I dont want that solution.

get datakey from gridview rowupdating-80get datakey from gridview rowupdating-75get datakey from gridview rowupdating-40

Basically, I was trying to convert an existing data-display-only Grid View (ie, no special functions) into one where I can update a field, namely the inventory for displayed products. New Edit Index 'set to selected row Bind Grid View() ' your own subroutine that you use to bind your datagrid End Sub Protected Sub Grid View1_Row Canceling Edit(By Val sender As System. Is this a limitation of creating the grid dynamically? When you are explaining your problem please post any code snippets that will help us understand what you are doing. None of them will retrieve anything but the old data. I just need the data, and I'll then run a stored procedure to update the values, THEN re-query it. The Confirm and Scrap commands all work fine, as do my refresh and display routines. In the future just post the portion of your code that's causing problems. When you do this your data is bound to your grid view and your newly entered information is lost...it's quite a common occurrence to Grid View update problems. I can't get this to work and I was hoping this would solve my problem trying to update a gridview without datasource. I've tried every method I can find to get the new value for a control, and it's continually coming back as the old method. Are you trying to update a Grid View based on a Data Set? I plan on parsing out a good bit of it to other components. The main problem I'm having is with the grd Dynamic_Row Updating subroutine. The commented lines are my various attempts to read the NEW data that the user inputs. None of them will retrieve anything but the old data. Hope this saves someone a full day of research (and possibly some hair)! To enhance this process, be sure to include your Grid View in an AJAX Update Panel.

Leave a Reply

the hook up dating