Link to home
Start Free TrialLog in
Avatar of rchambers
rchambersFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Gridview OnRowUpdating

Hi

I have a gridview which is populated from a query which concatenates a series of strings. This means that I can't directly edit via the edit button.

I have put an OnRowUpdating event handler which then changes the data progamatically. It seems to work fine except it doesn't reset the cancel/update buttons to edit.

   Protected Sub gwSubAddress_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs)
  ' does lots of stuff with stored procs which update the underlying data
        e.Cancel = True
    End Sub

How do I get the cancel/update buttons to be replaced with the edit button (ie have the effect of clicking the cancel button)

Thanks
Avatar of David Robitaille
David Robitaille
Flag of Canada image

you should use the OnRowUpdatad that occurs after the update to reset the UI and check for error.
RowUpdating Does the job
RowUpdatad  Check the job and update the ui
Avatar of rchambers

ASKER

Thanks

Sorry to be a pain but if I use e.cancel in the rowupdating handler then won't the OnRowUpdated fail to fire?

If I take the e.cancel out of the RowUpdating how do I reset it before I get the "Updating is not supported by data source 'sdsAddress' unless UpdateCommand is specified" error?
ASKER CERTIFIED SOLUTION
Avatar of David Robitaille
David Robitaille
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
that worked exactly as I wanted it to, thank you
Hey, I m glad i could help you! I was felling i was not so clear in that last comment, but i guess you get the essence of what i wanted to say.