TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
selvi subramanian
NA
799
570.9k
After insert my discount is changed in asp.net
Jun 15 2015 2:58 AM
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 purchase where lotno='" + txtBarcode.Text + "'";
cmd.Connection = con;
// DataTable dt = new DataTable();
using (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();
double total = dt.AsEnumerable().Sum(row => row.Field<double>("mrp"));
ddsales.FooterRow.Cells[3].Text = "Total";
ddsales.FooterRow.Cells[1].HorizontalAlign = HorizontalAlign.Right;
ddsales.FooterRow.Cells[4].Text = total.ToString("N2");
}
}
}
}
txtBarcode.Text = "";
txtBarcode.Focus();
}
protected void txtdispr_TextChanged(object sender, EventArgs e)
{
if (txtdispr.Text != "")
{
foreach (GridViewRow gvr in this.ddsales.Rows)
{
if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
{
string bqno = (gvr.FindControl("lblmrp") as Label).Text;
double dis, mmr, pmr, totdis, nowdis;
dis = int.Parse(txtdispr.Text);
mmr = int.Parse(bqno);
pmr = dis * mmr;
totdis = pmr / 100;
nowdis = mmr - totdis;
(gvr.FindControl("lblmrp") as Label).Text = Convert.ToString(nowdis);
}
txtdispr.Text = "";
break;
}
}
else
{
txtdispr.Focus();
}
}
http://s280.photobucket.com/user/celvsubramanian/library/
in this it shows the discount
Reply
Answers (
0
)
InvalidCastException was unhandled - Specified cast is not v
Data not storing in SQL from C# form