Free counters Added on January 19,2012 Follow Me @vmsdurano A bit About Me Disclaimer The opinions expressed herein are my own personal opinions and does not represent the opinions of my employers. Contol)Text; it werk just Fine any comment and thx for the code Instead of adding a Customer ID to your table and later pulling the text to get the ID number, a more reliable way to do it is to add a Data Key Names field to the grid example in the page: You can then access this information at any time with the following in code: Grid View1. Row Index]["id"]); You can do this with any field, but I've found customers get confused when they see the ID field and kept asking me why it was there, this also eliminates any issues if you change the display order of your table later (maybe add an edit/update/cancel control) Hey...great article ;)But I got a problem... So here I go with my example:protected void Grid View1_Row Updating(object sender, Grid View Update Event Args e) and the debugger says: Exception Details: System. Nor does it represent the opinion of my dog, because I don’t have one. I have a project that I coppied the above code into. Data Keys[Row Index]["Customer ID"]in the Update event it would be something like:int Customer ID = Convert. Format Exception: Input string was not in a correct format.
When we edit a row in our Grid View and press the “Update” button, at some time it’s received in the Row Updating method.In this example, I am going to retrieve values from categories table of Northwind database. Drag a Grid View into the Web Form and assign Data Key Names property with the primary key column i.e. In the gdview_Row Editing and gdview_Row Deleting event, we have used the below code to retrieve categoryid from datakey of Grid View, int catid = int. aspdotnet-suresh offers C#articles and tutorials,csharp dot net,articles and tutorials, VB.Check out what I’m trying to do, maybe you can help?First, I load up some data: After that, I’m doing some work to make my Grid View look beautifull, adding all columns by hand.This demo is a continuation of my previous example “Binding Grid View with Data”. When I do an update, and get to the Grid View1_Row Updating, there is no value passed to "ID", and then when I go to the next row for "Company" I get the following error: Specified argument was out of the range of valid values. Text; bit when ichange it to string id =((Text Box) Grid View1. Line 136: Source Error: Line 134: string Um = ((Text Box)Grid View1.