my design
Width="111px"> | ontextchanged="txtdispr_TextChanged"> | ||||
AutoGenerateColumns="false" onrowdatabound="ddsales_RowDataBound" onselectedindexchanged="ddsales_SelectedIndexChanged" onrowcommand="ddsales_RowCommand" ShowFooter="True" onrowdeleting="ddsales_RowDeleting" onselectedindexchanging="ddsales_SelectedIndexChanging" onprerender="ddsales_PreRender" onrowcreated="ddsales_RowCreated"> | |||||
Width="170px" /> onclick="Button1_Click" /> | |||||
my code
private void BindListView()
{
string constr = ConfigurationManager.AppSettings["s"].ToString();
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand())
{
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
cmd.CommandText = "SELECT distinct sectionname,lotno,Productname,mrp from purchasedummy where lotno='" + txtBarcode.Text + "'";
cmd.Connection = con;
//cmd.Parameters.AddWithValue("@PurchaseNo", Convert.ToInt32(this.barcodetx.Text.Trim()));
//cmd.Parameters.AddWithValue("@Qty", Convert.ToInt32(this.qty.Text.Trim()));
DataTable dt = new DataTable();
sda.Fill(dt);
DataTable products = new DataTable();
if (ViewState["Products"] == null)
{
products.Merge(dt, true);
}
else
{
products = (DataTable)ViewState["Products"];
products.Merge(dt, true);
}
ViewState["Products"] = products;
ddsales.DataSource = products;
ddsales.DataBind();
}
}
}
}
protected void txtqty_TextChanged(object sender, EventArgs e)
{
foreach (GridViewRow rowz in ddsales.Rows)
{
double mr, wt, totlrp;
mr =Convert.ToDouble((rowz.FindControl("lblmrp") as Label).Text);
wt = double.Parse(txtqty.Text);
totlrp = mr * wt;
(rowz.FindControl("lblmrp") as Label).Text = Convert.ToString(totlrp);
}
txtqty.Text = "1";
}

Replies
Know the answer? Post it — somebody with the same question will find it here.