protected void listPOItems_OnItemEditing(object sender, System.Web.UI.WebControls.ListViewEditEventArgs e) { listPOItems.EditIndex = e.NewEditIndex; qcpackingitemscollections objItems = new qcpackingitemscollections(); if (Session["StoresIndentItemCollection"] != null) objItems = (qcpackingitemscollections)Session["StoresIndentItemCollection"]; listPOItems.DataSource = objItems; listPOItems.DataBind(); // BindEditDDLs(); // DropDownList ddlMate = (DropDownList)listIndentItems.Items[e.NewEditIndex].FindControl("ddlMaterials"); TextBox txtseno = (TextBox)listPOItems.Items[e.NewEditIndex].FindControl("txtseno"); List<PackingInstructionItem> objIndentItemCollection = new List<PackingInstructionItem>(); if (Session["StoresIndentItems"] != null) objIndentItemCollection = (List<PackingInstructionItem>)Session["StoresIndentItems"]; var selVal = objIndentItemCollection.Where(i => i.ItemId == e.NewEditIndex + 1).Single(); // The below line Object reference is set to instance of object error will occured// txtseno.Text =Convert.ToString( selVal.SerialNo); ScriptManager.GetCurrent(this).SetFocus(txtseno); }
Session["StoresIndentItemCollection"]
null
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)