示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        // if (!IsPostBack)
        {
            MyBL    objbl = new MyBL();
            DataSet ds    = new DataSet();
            ds = objbl.GetAll();

            ddlcountry.DataSource     = ds;
            ddlcountry.DataValueField = "Id";
            ddlcountry.DataTextField  = "Country_Name";
            ddlcountry.DataBind();

            ddlcountry.Items.Insert(0, new ListItem("-- Select --", "0"));
        }
    }