GridView's NewValues and OldValues empty in the OnRowUpdating event

前端 未结 5 2108
南旧
南旧 2020-12-20 14:26

I have the GridView below. I am binding to a custom datasource in the code behind. It gets into the \"OnRowUpdating\" event just fine, but there are no NewValues or OldVal

5条回答
  •  抹茶落季
    2020-12-20 15:12

    You need to check the IsPostback in the form load. When the gridview's Update did the postback, it first refreshed with the old values. Use IsPostback to prevent this:

    If Not IsPostback Then 
    
       ' Data bind here
    
    End If
    

    This way, it will not overwrite the "new" gridview values

提交回复
热议问题