Gridview rowupdating dataitem null bro code for dating ex39s

19 Apr

New Edit Index 'Bind data to the Grid View control. Bind Data() End Sub Private Sub Create Data Table() Dim cmd As New System.

Dim dt = CType(Session("dt"), Data Table) 'Update the values.

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.

Last Change: More Information (@jwiscarson) I’m sorry, I was in hurry. In that project, the users could select 2 categories, enter a search string and the result will show in a Grid View. Here is my problem, if the "admin user" click on edit, change the value of the cell and execute the update, the value would not changed in the Hoo boy.

You didn't ask this in your question, but you've written some smelly code here.

Although this isn't as big of a problem when you're referencing the text from web controls, getting in the habit now will prevent you from serious headaches and inefficiently checking for null and empty later. NET 4.0, you should have access to event, you need to pull the new values out of the front-end controls, and then re-bind your data.

It looks like your source code is pretty close to the MSDN source code here.

If I had written the code, I would explicitly create all the front-end controls and use a binding command (if you aren't familiar, it looks like How should I create all front-end controls in the markup?

But I can’t find how to configure the Gridview to retain the Data Item.

Or do I have to go with plan B and rewrite the datasource object collection to a datatable and then use datakeysnames?

In my code I tend to write the databinding logic as part of the page logic which usually is just a couple of lines of code.

Anyway, the problem isn't that it can't be done 'manually' - but rather that there are a myriad of ways that you can hook up custom link/command processing and they are all similar but yet quite different.