Пример #1
0
 protected void BindState()
 {
     try
     {
         string country = null;
         if (ddlCountry.SelectedValue != "-1")
         {
             DataTable Dtaable = TMSState.GetSearch(null, Convert.ToInt32(ddlCountry.SelectedValue), null, 1).Tables[0];
             DataView  Dv      = new DataView(Dtaable);
             Dv.Sort                 = ("ST_State ASC");
             ddlState.DataSource     = Dtaable;
             ddlState.DataTextField  = "ST_State";
             ddlState.DataValueField = "ST_Id";
             ddlState.DataBind();
             ddlState.Items.Insert(0, new ListItem("Select", "0"));
         }
         else
         {
             DataTable Dtaable = TMSState.GetSearch(null, Convert.ToInt32(country), null, 1).Tables[0];
             DataView  Dv      = new DataView(Dtaable);
             Dv.Sort                 = ("ST_State ASC");
             ddlState.DataSource     = Dtaable;
             ddlState.DataTextField  = "ST_State";
             ddlState.DataValueField = "ST_Id";
             ddlState.DataBind();
             ddlState.Items.Insert(0, new ListItem("Select", "0"));
         }
     }
     catch (Exception ex) { }
 }
Пример #2
0
    public CascadingDropDownNameValue[] BindStateOnly(string knownCategoryValues, string category)
    {
        DataTable dt = new DataTable();

        dt = TMSState.GetSearch(null, null, null, 1).Tables[0];

        List <CascadingDropDownNameValue> cascadingValues = new List <CascadingDropDownNameValue>();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string State_Id   = dt.Rows[i]["ST_Id"].ToString();
            string State_Name = dt.Rows[i]["ST_State"].ToString();
            cascadingValues.Add(new CascadingDropDownNameValue(State_Name, State_Id));
        }
        return(cascadingValues.ToArray());
    }
Пример #3
0
    public CascadingDropDownNameValue[] BindState(string knownCategoryValues, string category)
    {
        string[] str       = knownCategoryValues.Split(':');
        int      CountryId = Convert.ToInt32(str[1].Substring(0, str[1].IndexOf(';')));

        DataTable dtState = new DataTable();

        dtState = TMSState.GetSearch(null, CountryId, null, 1).Tables[0];

        List <CascadingDropDownNameValue> cascadingValues = new List <CascadingDropDownNameValue>();

        for (int i = 0; i < dtState.Rows.Count; i++)
        {
            string StateId   = dtState.Rows[i]["ST_Id"].ToString();
            string StateName = dtState.Rows[i]["ST_State"].ToString();
            cascadingValues.Add(new CascadingDropDownNameValue(StateName, StateId));
        }
        return(cascadingValues.ToArray());
    }