In the ListBox ItemTemplate Demo, a numeric textbox is included to allow users to enter order Quantity. No problem creating a similar item template. No problem passing item.Value to SqlParameter and inserting to database. But I cannot figure out how to grab a value from a textbox and pass that as another parameter.
Code below passed an empty string or NULL to @Quantity:
foreach (RadListBoxItem item in collection)
{
cmd4.Parameters.Clear();
cmd4.Parameters.AddWithValue("@Product_ID", item.Value);
cmd4.Parameters.AddWithValue("@Quantity", Convert.ToInt32(item.FindControl("RadNumericTextBox1.Text") as TextBox));
cmd4.ExecuteNonQuery();
}
A few articles I found suggest textbox values are lost during postback? Anyone else run into this problem? Advice appreciated.