1

我无法在 Datalist EditItemTemplate 中获取 DropDownlist 值,因为它变为空。我尝试了文本框值控件,但它们再次变为空。我通过 FinControl 方法找到了控制,但它为空。我不使用 scriptmanager 并且使用 usercontrol 你能帮我解决这个问题吗?谢谢..

case "update":
                {
                    //foreach (DataListItem item in dlsepetim.Items)
                    //{
                    //    DropDownList tb = (DropDownList)item.FindControl("editdrop");
                    //    Response.Write(Convert.ToString(tb.SelectedIndex));
                    //}  

                    //int id = Convert.ToInt32(e.CommandArgument.ToString());
                    List<DL.Lib.Cart> sepetimu = CartManipulations.GetCart(Session["sepetim"]);
                    DL.Lib.Cart c = new Lib.Cart();
                    c = sepetimu.ElementAt(e.Item.ItemIndex);
                   //bool StokDurumu = bool.Parse(DataBinder.Eval(dr, "InStock").ToString());

                    //Response.Write(Convert.ToString(c.Quantity).ToString() + " " + c.ProductId + " " + c.ProductName);
                    DropDownList txt = (DropDownList)dlsepetim.Items[0].FindControl("editdrop");

                    int newQuantity = (e.Item.FindControl("editdrop") as DropDownList).SelectedIndex;

                    c.Quantity = newQuantity;
                    Session["sepetim"] = sepetimu;
                    dlsepetim.DataSource = CartManipulations.GetCart(Session["sepetim"]);
                    dlsepetim.EditItemIndex = -1;
                    dlsepetim.DataBind();
                }break;
4

0 回答 0