hi,
how can I validate a Boundfield in gridview that changes to textbox dynamically?
the boundfield is
<asp:BoundField DataField="quantity" HeaderText="quantity" />
and it chenges to textbox in code below
I want only number (1,2,3,...) in it not text.
protected void CartGrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
TextBox quantityTextBox = (TextBox)CartGrid.Rows[e.RowIndex].Cells[2].Controls[0];
int quantity = System.Convert.ToInt32(quantityTextBox.Text);
if (quantity == 0)
((ShoppingCart)Cache[username]).items.RemoveAt(e.RowIndex);
else
((ShoppingCart)Cache[username]).items[e.RowIndex].quantity = quantity;
CartGrid.EditIndex = -1;
BindGrid();
}