Gridview rowupdating get boundfield

Posted by / 28-Sep-2019 03:04

Gridview rowupdating get boundfield

How do I get the old values in a gridview row in the row_updating event?

I'm using a sqldatasource control to populate the grid and want to write the update code in the Row Updating event. I can get the value of the first field using " Select Command="SELECT @Week Ending Week Ending , Project , Project ID , Category , Category ID ,isnull([1], 0) Sun ,isnull([2], 0) Mon ,isnull([3], 0) Tue ,isnull([4], 0) Wed ,isnull([5], 0) Thu ,isnull([6], 0) Fri ,isnull([7], 0) Sat from (select P.

Time Entry Duration Hours FROM dbo.aspnet_starterkits_Time Entry TE inner join dbo.aspnet_starterkits_Project Categories CAT on TE. Category ID inner join dbo.aspnet_starterkits_Projects P on CAT. Time Entry User ID=(SELECT User Id FROM dbo.aspnet_Users WHERE User [email protected] Name)) Source pivot (max(Hours)for DOW in ([1],[2],[3],[4],[5],[6],[7]) ) as pvt" Old Values Parameter Format String="original_" Use the Old Values property (dictionary) to access the original values of the fields in the row to update.

Time Entry Date between dateadd(dd, -6, @Week Ending) and @Week Ending) AND TE.

Old Values[someindexfromyoureditablevalues] Is it a datakeyfield? I'll test your response though and use it with future Bound Fields.

string connetion String = "YOUR_CONSTR" ; string upd Stmt = "UPDATE Quantity set [email protected]_pro4, [email protected]_pro5, [email protected]_profile5 " "where [email protected] Name"; using (Sql Connection cnn = new Sql Connection(connetion String)) I have tested this code, and it reads the table, and allows the edits of the records.

Make sure the parameters on the update match the field names (@branch Name, @Parent Id).

Edit Index = -1 'Bind data to the Grid View control. Sql Command Dim sql As String Dim reader As System.

Sql Command Dim sql3 As String Dim reader3 As System.

gridview rowupdating get boundfield-68gridview rowupdating get boundfield-77gridview rowupdating get boundfield-42

In my VB Gridview, I had bind several column from datatable into one single column of the gridview. The following is the VB code: Protected Sub Grid View1_Row Editing(By Val sender As Object, By Val e As Grid View Edit Event Args) 'Set the edit index. Bind Data() End Sub Protected Sub Grid View1_Row Canceling Edit(By Val sender As Object, By Val e As Grid View Cancel Edit Event Args) 'Reset the edit index. Edit Index = -1 'Bind data to the Grid View control.

One thought on “gridview rowupdating get boundfield”