示例#1
0
    public void BindDDL()
    {
        DataTable dtState = StateClass.GetAllState();

        if (dtState.Rows.Count > 0)
        {
            ddlState.DataTextField  = "StateName";
            ddlState.DataValueField = "StateIDP";
            ddlState.DataSource     = dtState;
            ddlState.DataBind();
            ddlState.Items.Insert(0, new ListItem("--Select State--", "-1"));
            ddlState.SelectedIndex = 0;
        }

        DataTable dtCity = CityClass.GetAllCity();

        if (dtCity.Rows.Count > 0)
        {
            ddlCity.DataTextField  = "CityName";
            ddlCity.DataValueField = "CityIDP";
            ddlCity.DataSource     = dtCity;
            ddlCity.DataBind();
            ddlCity.Items.Insert(0, new ListItem("--Select City--", "-1"));
            ddlCity.SelectedIndex = 0;
        }
    }
示例#2
0
 public void BindData()
 {
     rptData.DataSource = CityClass.GetAllCity();
     rptData.DataBind();
 }