Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
0
Reply
Adding Cart in the Grid ?..
Karthik Che
Nov 13 2017 5:04 AM
174
Reply
Hi All,
I want to add the additional qty on my Dishcart of grid. Whenever I am clicking the addup button ., it should be Incremented by 1. How can do it. Can anyone guide me? Thanking you
Sample code :
protected void grdCart_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Qty")
{
for (int i = 0; i < grdCart.Rows.Count; i++)
{
TextBox Tb = (TextBox)grdCart.Rows[i].FindControl("txtEditCount");
QtyCount = Convert.ToInt32(Tb.Text);
QtyCount += 1;
DishCart_DataTable.Rows[i]["Count"] = QtyCount;
DishCart_DataTable.Rows[i]["Total"] = QtyCount * Convert.ToDecimal(DishCart_DataTable.Rows[i]["Price"]);
// Loading Grid..
grdCart.DataSource = DishCart_DataTable;
grdCart.DataBind();
}
}
}
This code has some issue. when click the add up button its added but when I select some other dish. Already selected items getting incremented by that should not happen. I Want to update the qty on the particular row on in grid.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
how to show repeater images in bootstrap carousel?
how to replace _thumb to banner in eval in asp.net code