private void BindFromCity() { TrackingDAL obj = new TrackingDAL(); var ToCity = obj.BindAllToCity(); obj = null; if (ToCity.Count > 0) { DdlFromCity.DataSource = ToCity; DdlFromCity.DataTextField = "city_name"; DdlFromCity.DataValueField = "city_idno"; DdlFromCity.DataBind(); DdlFromCity.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0")); } }
private void BindDropdown() { TrackingDAL obj = new TrackingDAL(); var LaneList = obj.BindLaneName(); var ToCity = obj.BindAllToCity(); var ToTruck = obj.BindLorry(); var ToComp = obj.BindCompany(); var ToFromLoc = obj.BindFromLoc(); obj = null; DdlLane.DataSource = LaneList; DdlLane.DataTextField = "Lane_Name"; DdlLane.DataValueField = "Lane_Idno"; DdlLane.DataBind(); DdlLane.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0")); DdlFromCity.DataSource = ToCity; DdlFromCity.DataTextField = "city_name"; DdlFromCity.DataValueField = "city_idno"; DdlFromCity.DataBind(); DdlFromCity.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0")); DdlToCity.DataSource = ToCity; DdlToCity.DataTextField = "city_name"; DdlToCity.DataValueField = "city_idno"; DdlToCity.DataBind(); DdlToCity.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0")); DdlVehicleNo.DataSource = ToTruck; DdlVehicleNo.DataTextField = "Lorry_No"; DdlVehicleNo.DataValueField = "Lorry_Idno"; DdlVehicleNo.DataBind(); DdlVehicleNo.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0")); DdlCompName.DataSource = ToComp; DdlCompName.DataTextField = "Comp_Name"; DdlCompName.DataValueField = "Comp_Idno"; DdlCompName.DataBind(); DdlCompName.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0")); DdlFromLoc.DataSource = ToFromLoc; DdlFromLoc.DataTextField = "City_Name"; DdlFromLoc.DataValueField = "City_Idno"; DdlFromLoc.DataBind(); DdlFromLoc.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0")); }