How can I identify the edited row in GridView?

My client wanted the GridView to display fields inside TextBoxes, and DropDownListBoxes only. He wanted the flexibility to update the Record just by clicking on the Update button after altering the values in the cell.

He wanted the current editing GridViewRow in some different color so that he can click on "Update" button for that particular row.

How can I identify the current editing row in the GridView? Since there is no edit button to click on!!

-------------Problems Reply------------

Probably you are looking for GridView.EditIndex

Also here is tutorial which looks like fit your problem:

Based on Gridview rows EditItemIndex you can find whether a row is in Edit mode or not. Refer to this to know more.

you can select the Row by using this code,And show the Row with different color. u can highlight,

protected override void Render(System.Web.UI.HtmlTextWriter writer)
private void AddRowSelectToGridView(GridView gv)
foreach (GridViewRow row in gv.Rows)
row.Attributes["onmouseover"] = "'hand';'underline';";
row.Attributes["onmouseout"] = "'none';";
row.Attributes.Add("onclick",Page.ClientScript.GetPostBackEventReference(gv,"Select$"+row.RowIndex.ToString(), true));
catch (Exception ex)
{ }

Are you talking a multi-line edit? Or a scenario where all rows show their editable UI? The best way, if this is the case, is to use TemplateFields for all fields, and render the textboxes/other controls in the template. Out of the box, multi-row editing is not supported.

Or you can create a custom control like what was done here:

If you are talking simply editing, selecting the AutoGenerateUpdateButton="true" will add an update button, or manually add a commandfield and set its CommandName to update.

HTH. Views:1 Time:2011-09-28

Related post

  • Can't set a value to a cell of current editing row for gridview 2012-04-12

    I'm trying on row updating to set a new value (for the current editing row) to a certain cell that has already a value in the gridview and the value should be also changed in the data table. SqlDataSource,Gridview: Column called : Nom , type : int. C

  • edit row in gridview 2011-01-18

    I would like to help me with my code. I have 2 gridviews. In the first gridview the user can choose with a checkbox every row he wants. These rows are transfered in the second gridview. All these my code does them well.Now, I want to edit the quantit

  • Edit row in gridview with hyperlink in ASP.NET 2011-04-15

    I've got a gridview displaying product instance info; I need a hyperlink in my Action column to bring up an view/edit page that displays the row data. How do I make the link bring up the data from that specific row into the edit page? Note: there are

  • gridview: How to get a value from database cell of the current edited row? 2012-03-26

    I'm using : 1.A Gridview 2.SqlDataSource to bind set the table data information to gridview. I want to get from the edited row in gridview the value of a cell from database of the same row. thanks --------------Solutions------------- In that case, si

  • How can I Get all the rows of Gridview to be editable mode? 2010-01-18

    Getting all the rows of Gridview to be editable mode. Here is Gridview Source.. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ods" DataKeyNames="abc" EmptyDataText="There is no entry..." AllowPaging="false"

  • Email row that has been edited in a gridview 2010-02-04

    Afternoon all. I have a gridview that offers a line per line 'feedback' column. Upon updating, a nice little message box says "Thanks for the feedback, we'll be in touch...etc, etc" How would I go about grabbing this edited row of the gridview and se

  • Edit rows based on condition in JQGRID 2010-03-29

    Using FORM EDIT IN JQGRID. I am display the rows in different color; Red: Row cannot be edited. Black: Row can be edited 1 Option When the user click edit button and if the selected row is in red color; Message should be displayed record cannot be ed

  • jqgrid - format when editing row 2010-12-02

    I use client side library jqGrid. When I display column I use format options of column like this { name: 'Salary', index: 'Salary', width: 100, align: 'right', sortable: false, editable: true, formatter: 'number', formatoptions: { decimalSeparator: "

  • Is there an editor for inserting/editing rows into a Core Data DB? 2010-12-11

    I've created a Core Data schema in xcode (3.2.5 if it matters) so I have the .xcdatamodel file with the proper entities and relations. Now - How can I insert data, edit data and/or delete data from it, NOT from within the code ? Like what phpMyAdmin

  • how to open row in edit mode in gridview 2010-12-15

    how to make gridview ro visible false when i click on delete button because i am using static data and i want to open the row in gridview in edit mode when i click on edit button. How to do this in c# --------------Solutions------------- Are the Dele

  • Grouped uitableview with editable rows - Apple example gives me a crash 2011-02-21

    I'm trying to create a grouped tableview with editable rows (the number of rows is fixed). I've found this Apple example, in particular the section The Technique for Static Row Content. I implemented it, but the app crashed with this error *** Assert

  • WPF DataGrid - Disable Sorting and Filtering while Editing Rows? 2011-03-08

    Has anyone tried to implement the following scenario? I would be interested in learning what solutions are out there to accomplish this. This has become a real pain for our users... We have a WPF DataGrid that gives the user the ability to filter the

  • Working Example on Add Inline row, delete and Edit Row in Jqgrid 2011-03-26

    There are alot example of adding, deleting and editing row in jqgrid in the net but no one has provide a 'complete' good and working example of jqgrid in the following requirements :- 1) NEW Button And DELETE Button in Navigator bar of jqgrid 2) A cl

  • jqGrid edit row with response 404 not found 2011-04-01

    I have started to use jqGrid in our project a few days ago and now I have a problem I can't solve. Below is my code: var colModel = JSON.parse(gridResult.ColModel); var grid = $("#tblGrid").jqGrid({ url: './WebServices/Demand.asmx/GetDemandOpenHoursT

  • Confuse in how to post data for edit row in jqgrid 2011-05-26

    This is the first time I'm using jqgrid. I have confused in how to post all value from modal's edit row(pencil icon). I'm so familiar with dataTable but not in this plugin. I need some server side script for this edit process. So, I can learn from it

  • postgresql and django - No unique identifier for this row 2011-07-11

    Two entries on my Django postgresql database are causing me a world of trouble when I go a-querying to create reports. When I try to delete these entries (via phpPgAdmin), I get the error "No unique identifier for this row." There are no duplicate ID

  • jqGrid, disabled edited row 2011-08-02

    In our application the user is able to edit multiple rows at the same time. When he clicks the save button all the rows are saved to DB, one by one. The problem I have is that when a user fills in something wrong for example skipping a required field

  • Why does focusing on an input field of a jqGrid editable row cause the row to be 'de-selected'? 2011-08-15

    I've a jqGrid instance which featured with multiselection and inline editing. I wrote some code in the beforeSelectRow event so that the multiple selection can be achieved by ctrl-key, and range selection by shift-key; as well as single selection by

  • Disable the Edit button on all the rows when Edit button is clicked on a particular row in GridView 2011-09-16

    I have a gridView with 5 columns with Edit and Delete button on each row of GridView. Once an Edit button a particular row is clicked , I want to disable the edit and delete buttons on rest of the rows. Below is my aspx <asp:GridView ID="GridView1

Copyright (C), All Rights Reserved.

processed in 0.102 (s). 11 q(s)