Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this it work on my machine on your code on aspx.cs page:</p> <pre><code> protected void GridView1_RowUpdating1(object sender, GridViewUpdateEventArgs e) { string id = GridView1.DataKeys[e.RowIndex].Values["duty_slip_no"].ToString(); Label duty_slip_no = (Label)GridView1.Rows[e.RowIndex].FindControl("lbldutyslip"); TextBox txtdate = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtdate"); SqlCommand cmd = new SqlCommand("update add_duty_slip set slip_date='" + txtdate.Text + "',company='" + txtcompany.Text + "' where duty_slip_no=" + id, con); con.Open(); cmd.ExecuteNonQuery(); GridView1.EditIndex = -1; con.Close(); lblMessage.Text = "Update Successfully"; } </code></pre> <p>and on aspx page:</p> <pre><code> &lt;asp:GridView ID="GridView1" DataKeyNames="duty_slip_no" runat="server" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" onrowcancelingedit="GridView1_RowCancelingEdit" onrowdeleting="GridView1_RowDeleting1" onrowediting="GridView1_RowEditing1" onrowupdated="GridView1_RowUpdated" onrowupdating="GridView1_RowUpdating1" AutoGenerateColumns="False"&gt; &lt;Columns&gt; &lt;asp:TemplateField HeaderText="Date"&gt; &lt;EditItemTemplate&gt; &lt;asp:TextBox ID="txtdate" runat="server" Text='&lt;%#Eval("slip_date") %&gt;'/&gt; &lt;/EditItemTemplate&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lbldate" runat="server" Text='&lt;%#Eval("slip_date") %&gt;'/&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText="company"&gt; &lt;EditItemTemplate&gt; &lt;asp:TextBox ID="txtcompany" runat="server" Text='&lt;%#Eval("company") %&gt;'/&gt; &lt;/EditItemTemplate&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblcompany" runat="server" Text='&lt;%#Eval("company") %&gt;'/&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; </code></pre> <p>same for other columns also it work on my machine</p>
    singulars
    1. This table or related slice is empty.
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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