Dear All,
May i know how to update each data in gridview from template field textbox?
if select reason is adjust-In then update plus the qty else adjust -Out minus the qty.
<asp:GridView ID="GridView1" HeaderStyle-BackColor="#3A64F2" HeaderStyle-ForeColor="White" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField= "RowNumber" HeaderText="RowNumber" />
<asp:BoundField DataField= "INV_ID" HeaderText="INV_ID" ItemStyle-Width="150" />
<asp:BoundField DataField= "INV_TYPE" HeaderText="INV_TYPE" ItemStyle-Width="150" />
<asp:BoundField DataField= "INV_SHORTDESC" HeaderText="INV_SHORTDESC" ItemStyle-Width="150" />
<asp:BoundField DataField= "INV_LOCATION" HeaderText="INV_LOCATION" ItemStyle-Width="150" />
<asp:BoundField DataField= "INV_QTY" HeaderText="INV_QTY" ItemStyle-Width="100" />
<asp:TemplateField HeaderText="Adjust Qty">
<ItemTemplate>
<asp:TextBox ID="Inv_AdjQty" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void Page_Load(object sender, EventArgs e)
{
string conString = ConfigurationManager.ConnectionStrings["CIMProRPT01ConnectionString"].ConnectionString;
string query = "SELECT ROW_NUMBER() OVER (Order by A.INV_ID,A.INV_TYPE,A.INV_SHORTDESC,B.INV_LOCATION,B.INV_QTY) AS RowNumber,A.INV_ID,A.INV_TYPE,A.INV_SHORTDESC,B.INV_LOCATION,B.INV_QTY FROM CIMProRPT01.dbo.OTH_INV_DETAILS A JOIN CIMProRPT01.dbo.OTH_INV_QTY_LOC B ON A.INV_ID = B.INV_ID WHERE 1=1 and A.INV_TYPE =@INV_TYPE ORDER BY A.INV_ID,A.INV_TYPE,B.INV_LOCATION";
SqlCommand cmd = new SqlCommand(query);
cmd.Parameters.AddWithValue("@INV_TYPE", ddlCountry.SelectedItem.Value);
using (SqlConnection con = new SqlConnection(conString))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataSet ds = new DataSet())
{
sda.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
}
}
}