コード例 #1
0
    public void FillState()
    {
        DataTable            dt = new DataTable();
        GetStateTableAdapter dv = new GetStateTableAdapter();

        dt = dv.GetDataBy();
        State_ddl.DataSource     = dt;
        State_ddl.DataValueField = "StateID";
        State_ddl.DataTextField  = "StateName";
        State_ddl.DataBind();
        ListItem li = new ListItem("--select---", "-1");

        State_ddl.Items.Insert(0, li);
    }
コード例 #2
0
    public void FillElectionState()
    {
        try
        {
            GetStateTableAdapter St = new GetStateTableAdapter();
            DataTable            dt = new DataTable();
            dt = St.GetElectionState();
            State_ddl.DataSource     = dt;
            State_ddl.DataValueField = "StateID";
            State_ddl.DataTextField  = "StateName";
            State_ddl.DataBind();
            ListItem li = new ListItem("---select---", "-1");
            State_ddl.Items.Insert(0, li);
        }

        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Repeated Election are taking place in same state..!.');window.location='Welcome2.aspx';", true);
        }
    }