-1
有2 DataList控件DataList2
和DataList3
DataList2
有DataList3
和Button
和lblOrderID
DataList3
有lblQuantity
Click上的lblQuantity
Button
價值應該分配給qty
當我調試這段代碼時,它顯示qty爲空?
錯誤:未將對象引用設置爲對象的實例。
如何訪問內部DataList的標籤是在另一個內部的DataList
protected void bremove_Click(object sender, EventArgs e)
{
Button remove = (Button)sender;
DataListItem row = remove.NamingContainer as DataListItem;
DataList dat = (DataList)row.FindControl("DataList3");
Label qty = (Label)dat.FindControl("lblQuantity");
Label id = (Label)row.FindControl("lblOrderID");
string oid = id.Text;
string oqty = qty.Text;
sqlqueries.UpdateOrder(oid, oqty);
int k = sqlqueries.CancelOrder(oid);
if (k != 0)
{
Response.Redirect(Request.RawUrl);
}
}