Gridview1 rowupdating e newvalues

Row Updating event, doesn’t work as all samples say it should do.All samples of course assume you’re doing everything in your page, but I have to do everything in my code-behind, because on forehand I don’t know what I’ll be binding to my Grid View.Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free.You'll be able to ask questions about coding or chat with the community and help others.Right now you must be asking yourself how can you get those dictionaries filled out just as if you were bound to a Datasource control?

Obviously the simplest method is to use Data Key Names on the Grid View and then you should have the data in your Grid View Update Event Args as part of e. (In the following example, I cast to a Check Box as I know I have a checkbox at the col Index You Are Interested In - you should cast to whatever control you have in that column).Unfortunately these dictionaries are only filled out if you are bound to a datasource control :(.So that means when you bind to some raw collection and hook up to the Data Source property then call databind, if you try to handle the delete or update events these dictionaries are going to be empty. So what you need to do is store the data source (maybe in Session) and only bind rebind the data when you absolutely need to (Like during the Is Not Post Back) Do you understand? Please post the code for your Page_Load method and the that handles your Update (your C# code) so we can have a better look at what's going on. Please give some references and/or details of how to. This wipes out the data provided by the user during editing (editing happens after the page load).If you go with the flow, you probably won't get stuck, but the moment you try to go against the grain you end up with a hand full of thorns.

844

Leave a Reply