public void getcountry(DropDownList ddl) { DataTable dtcountry = new DataTable(); objData = new MasterData(); dtcountry = objData.Getcountry("Y"); ddl.DataSource = dtcountry; ddl.DataTextField = "country_name"; ddl.DataValueField = "country_id"; ddl.DataBind(); ddl.Items.Insert(0, "-Select-"); ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByText("USA")); }
public void grdfill() { try { // DataTable dt = new DataTable(); objData = new MasterData(); DataTable dtcounty = new DataTable(); dtcounty = objData.Getcountry(); if (dtcounty.Rows.Count > 0) { grdCountry.DataSource = dtcounty; grdCountry.DataBind(); } else { foreach (DataColumn cl in dtcounty.Columns) { cl.AllowDBNull = true; } dtcounty.Rows.Add(dtcounty.NewRow()); grdCountry.DataSource = dtcounty; grdCountry.DataBind(); int columncount = grdCountry.Rows[0].Cells.Count; grdCountry.Rows[0].Cells.Clear(); grdCountry.Rows[0].Cells.Add(new TableCell()); grdCountry.Rows[0].Cells[0].ColumnSpan = columncount - 2; grdCountry.Rows[0].Cells[0].Text = "No Records Found"; grdCountry.Columns[columncount - 2].Visible = false; } grdCountry.FooterRow.Visible = true; } catch (Exception ex) { throw ex; } }
public void fillcountry() { MasterData objmst = new MasterData(); DataTable dt = objmst.Getcountry(); CommonFun objcf = new CommonFun(); objcf.FillDropDownList(ddlcountry, dt, "Country_Name", "Country_ID"); //DropDownList ddlcountrync = Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("ddlcountrync") as DropDownList; //objcf.FillDropDownList(ddlcountrync, dt, "Country_Name", "Country_ID"); }
protected void Repnearbymetro_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Footer) { MasterData mdl = new MasterData(); DataTable dt = new DataTable(); CommonFunction.CommonFun objcf = new CommonFunction.CommonFun(); DropDownList ddlcitynearby = e.Item.FindControl("ddlcitynearby") as DropDownList; dt = mdl.GetCityStates(); objcf.FillDropDownList(ddlcitynearby, dt, "City_Name", "City_id"); dt = mdl.Getstate(); DropDownList ddlstatenc = e.Item.FindControl("ddlstatenc") as DropDownList; objcf.FillDropDownList(ddlstatenc, dt, "state_name", "state_id"); MasterData objmst = new MasterData(); dt = new DataTable(); dt = objmst.Getcountry(); DropDownList ddlcountrync = e.Item.FindControl("ddlcountrync") as DropDownList; objcf.FillDropDownList(ddlcountrync, dt, "Country_Name", "Country_ID"); } }
protected void fillcountry() { MasterData mdl = new MasterData(); DataTable dt = new DataTable(); dt = mdl.Getcountry(); ddlcountry.DataSource = dt; ddlcountry.DataValueField = "country_id"; ddlcountry.DataTextField = "country_name"; ddlcountry.DataBind(); ListItem li = new ListItem("-Select-", "0"); ddlcountry.Items.Insert(0, li); }