public void grdfill() { try { dtstate.Clear(); dtstate = new DataTable(); objData = new MasterData(); dtstate = objData.Getstate(); if (dtstate.Rows.Count > 0) { grdState.DataSource = dtstate; grdState.DataBind(); } else { foreach (DataColumn cl in dtstate.Columns) { cl.AllowDBNull = true; } dtstate.Rows.Add(dtstate.NewRow()); grdState.DataSource = dtstate; grdState.DataBind(); int columncount = grdState.Rows[0].Cells.Count; grdState.Rows[0].Cells.Clear(); grdState.Rows[0].Cells.Add(new TableCell()); grdState.Rows[0].Cells[0].ColumnSpan = columncount - 2; grdState.Rows[0].Cells[0].Text = "No Records Found"; grdState.Columns[columncount - 2].Visible = false; } grdState.FooterRow.Visible = true; DropDownList ddlcountry = grdState.FooterRow.FindControl("ddlCountry") as DropDownList; getcountry(ddlcountry); } catch (Exception ex) { throw ex; } }
protected void fillstate() { MasterData mdl = new MasterData(); DataTable dt = new DataTable(); dt = mdl.Getstate(); CommonFunction.CommonFun objcf = new CommonFunction.CommonFun(); objcf.FillDropDownList(ddlstate, dt, "state_name", "state_id"); //DropDownList ddlstatenc = Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("ddlstatenc") as DropDownList; //objcf.FillDropDownList(ddlstatenc, dt, "state_name", "state_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 fillstate() { MasterData mdl = new MasterData(); DataTable dt = new DataTable(); dt = mdl.Getstate(); ddlstate.DataSource = dt; ddlstate.DataValueField = "state_id"; ddlstate.DataTextField = "state_name"; ddlstate.DataBind(); ListItem li = new ListItem("-Select-", "0"); ddlstate.Items.Insert(0, li); }