Note that there are some explanatory texts on larger screens.

plurals
  1. POediting one column of data grid view
    primarykey
    data
    text
    <p>I know how I can edit an entire row in the data grid view, I would like to know how to edit only one column keeping rest of the data the same. The current code that I have is given below and I would like to know how I would be able to just edit one column and update that data to the data table. I would like to edit only column "ab".</p> <p>HTML CODE</p> <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateEditButton="True" OnRowEditing="Gridview1_rowediting" OnRowUpdating="Gridview_RowUpdating" OnRowCancelingEdit="Gridview_EditCanceling" &gt; &lt;/asp:GridView&gt; </code></pre> <p>C# code behind </p> <pre><code>DataTable dt = new DataTable(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { add(); } } private void add() { dt.Columns.Add("ab", typeof(string)); dt.Columns.Add("ac", typeof(string)); dt.Columns.Add("av", typeof(string)); dt.Columns.Add("ax", typeof(string)); DataRow row = dt.NewRow(); row["ac"] = "sndasbfb"; row["av"] = "sndasbfb"; row["av"] = "sndasbfb"; row["ax"] = "sndasbfb"; dt.Rows.Add(row); GridView1.DataSource = dt; //ProjectsGridView.DataSource = dt; //ReleasesGridView.DataSource = dt; GridView1.DataBind(); // ProjectsGridView.DataBind(); // ReleasesGridView.DataBind(); } protected void Gridview1_rowediting(object sender, GridViewEditEventArgs e) { //GridView1.EditIndex = e.NewEditIndex; } protected void Gridview_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = GridView1.Rows[e.RowIndex]; } protected void Gridview_EditCanceling(object sender, GridViewCancelEditEventArgs e) { GridView1.EditIndex = -1; add(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload