Hi smile,
For this you can to use the AJAX Control Toolkit NumericUpDownExtender. There is no need to use RowCommand event to increment the value.
Check this example. Now please take its reference and correct your code.
HTML
<%@ register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<cc1:ToolkitScriptManager runat="server">
</cc1:ToolkitScriptManager>
<asp:GridView ID="GridView1" runat="server" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White"
CssClass="table table-striped table-bordered table-hover" AutoGenerateColumns="false"
Width="100%">
<Columns>
<asp:TemplateField HeaderText="Product Code" ItemStyle-Width="150">
<ItemTemplate>
<asp:Label ID="lblCode" runat="server" Text='<%# Eval("ItemCode") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ItemName" HeaderText="Product Name" ItemStyle-Width="200px" />
<asp:BoundField DataField="Rate" HeaderText="Price" ItemStyle-CssClass="price" ItemStyle-Width="100px" />
<asp:TemplateField HeaderText="Quantity" ItemStyle-Width="300px">
<ItemTemplate>
<asp:TextBox ID="txtQuantity" runat="server" Text="0" class="form-control" Width="100px"></asp:TextBox>
<cc1:NumericUpDownExtender ID="nudeQuantity" runat="server" TargetControlID="txtQuantity"
Width="50" Enabled="True" Minimum="1" TargetButtonUpID="btnAdd" TargetButtonDownID="btnSub">
</cc1:NumericUpDownExtender>
<asp:Button ID="btnAdd" Text="Add" Class="btn btn-info" runat="server" />
<asp:Button ID="btnSub" Text="Sub" Class="btn btn-info" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Total" ItemStyle-Width="200px">
<ItemTemplate>
<asp:Label ID="lblTotal" runat="server" Text="0"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="True" ButtonType="Button" ControlStyle-CssClass="btn btn-danger" />
</Columns>
</asp:GridView>
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[] {
new DataColumn("ItemCode", typeof(string)),
new DataColumn("ItemName", typeof(string)),
new DataColumn("Rate",typeof(string)) });
dt.Rows.Add("R-000003", "Pencil", "200");
dt.Rows.Add("R-000001", "Islamiate", "100");
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
Screenshot