protected void EditRow(int index) { gvForStationeryCatalogue.EditIndex = index; gvForStationeryCatalogue.DataBind(); GridViewRowCollection a = gvForStationeryCatalogue.Rows; GridViewRow row = a[index]; Label itemLabel = (Label)row.FindControl("LblItemCode"); DropDownList ddl = (DropDownList)row.FindControl("DdlCategory"); DropDownList ddl2 = (DropDownList)row.FindControl("DdlUOM"); ddl.DataTextField = "CategoryName"; ddl.DataValueField = "CategoryID"; List <Category> categories = EFBroker_Category.GetCategoryList(); Item item = EFBroker_Item.GetItembyItemCode(itemLabel.Text); ddl.DataSource = categories; ddl.SelectedValue = item.CategoryID.ToString(); ddl.DataBind(); ddl2.DataSource = EFBroker_Item.GetDistinctUOMList(); ddl2.SelectedValue = item.UnitOfMeasure; ddl2.DataBind(); row.BackColor = Color.Yellow; return; }
protected void Page_Load(object sender, EventArgs e) { ItemBusinessLogic ilogic = new ItemBusinessLogic(); List <Category> catList = EFBroker_Category.GetCategoryList(); Category temp = new Category(); temp.CategoryID = 0; temp.CategoryName = "Other"; catList.Add(temp); DdlCategory.DataSource = catList; DdlCategory.DataTextField = "CategoryName"; DdlCategory.DataValueField = "CategoryID"; List <string> UOMList = EFBroker_Item.GetDistinctUOMList(); UOMList.Add("Other"); DdlUOM.DataSource = UOMList; if (Session["itemlist"] == null) { iList = new List <Item>(); LblSubtitle.Visible = false; } else { iList = (List <Item>)Session["itemlist"]; if (iList.Count != 0) { LblSubtitle.Visible = true; } } // data population gvItemAdded.DataSource = iList; gvItemAdded.DataBind(); if (!IsPostBack) { DdlUOM.DataBind(); DdlCategory.DataBind(); } ControlToUpdate(TxtCategory, DdlCategory); ControlToUpdate(TxtUOM, DdlUOM); }
public static List <string> GetDistinctUOMList() { return(EFBroker_Item.GetDistinctUOMList()); }