Пример #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        addValue();
        Session["Qid"] = Convert.ToInt16(Session["Qid"]) + 1;
        int id = Convert.ToInt16(Session["Qid"]);


        //MAKING THE NEXT BUTTON VISIBLE AND INVISIBLE.
        if (id < GridView1.Rows.Count - 1)
        {
            Button1.Visible = true;
        }
        else
        {
            Button1.Visible = false;
        }

        //INCREAMENTING THE QUESTIONS.
        // Response.Write(Convert.ToString(id));
        QuestionNo.Text    = Convert.ToString(id + 1);
        QuestionID.Text    = GridView1.Rows[id].Cells[0].Text;
        LabelQuestion.Text = GridView1.Rows[id].Cells[1].Text;
        RadioButtonList1.DataBind();
        LoadButton();
    }
Пример #2
0
        protected override void OnPreRender(EventArgs e)
        {
            if (!IsPostBack)
            {
                string[]  colAlias  = SampleConstants.BoundDataColumns;
                ArrayList ThemeList = new ArrayList();
                ThemesAndModifiers.FillThemeNames(ThemeList);

                DropDownList1.Items.Clear();
                DropDownList1.DataSource = ThemeList;
                DropDownList1.DataBind();

                // Prepare CheckBoxes, RadioButtons and note label contents.
                CheckBoxList1.DataSource = colAlias;
                CheckBoxList1.DataBind();
                CheckBoxList1.Visible = this.IsCheckBoxListVisible(ThemeList[0] as string);

                RadioButtonList1.DataSource = colAlias;
                RadioButtonList1.DataBind();
                RadioButtonList1.Visible = this.IsRadioButtonListVisible(ThemeList[0] as string);

                Label2.Visible = this.IsNoteLabelVisible(ThemeList[0] as string);
                Label2.Text    = "Please select two columns from below checkboxes.";

                DropDownList1.Items.Clear();
                DropDownList1.DataSource = ThemeList;
                DropDownList1.DataBind();
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataSet ds   = new DataSet();
                string  Path = Server.MapPath("~/App.xml");
                ds.ReadXml(Path);
                DropDownList1.DataSource     = ds.Tables[0];
                DropDownList1.DataTextField  = "Name";
                DropDownList1.DataValueField = "Id";
                DropDownList1.DataBind();

                RadioButtonList1.DataSource     = ds.Tables[0];
                RadioButtonList1.DataTextField  = "Name";
                RadioButtonList1.DataValueField = "Id";
                RadioButtonList1.DataBind();

                ListBox1.DataSource     = ds.Tables[0];
                ListBox1.DataTextField  = "Name";
                ListBox1.DataValueField = "Id";
                ListBox1.DataBind();

                CheckBoxList1.DataSource     = ds.Tables[0];
                CheckBoxList1.DataTextField  = "Name";
                CheckBoxList1.DataValueField = "Id";
                CheckBoxList1.DataBind();
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["indirim"] != null)
            {
                h1Baslik.InnerText = Session["indirim"].ToString();
            }

            //Cookie OKUMA
            //if (Request.Cookies["MyCookie"] != null)
            //{
            //    HttpCookie kukim = Request.Cookies["MyCookie"];
            //    LabelAd.Text = kukim["Ad"];
            //    LabelSepet.Text = kukim["Sepet"];
            //}
            if (Request.Cookies["MyCookie"] != null)
            {
                LabelAd.Text    = Request.Cookies["MyCookie"]["Ad"];
                LabelSepet.Text = Request.Cookies["MyCookie"]["Sepet"];
            }

            if (IsPostBack == false)// if(!IsPostBack)
            {
                CheckBoxList1.DataSource = repoBrand.GetAll().OrderBy(o => o.Name).ToList();
                CheckBoxList1.DataBind();

                RadioButtonList1.DataSource = repoBrand.GetAll().OrderBy(o => o.Name).ToList();
                RadioButtonList1.DataBind();

                DropDownList1.DataSource = repoBrand.GetAll().OrderBy(o => o.Name).ToList();
                DropDownList1.DataBind();

                GridView1.DataSource = repoBrand.GetAll().OrderBy(o => o.Name).ToList();
                GridView1.DataBind();
            }
        }
Пример #5
0
    protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
    {
        List <dynamic> dept = sc.getdept(DropDownList3.SelectedItem.Text).ToList();

        RadioButtonList1.DataSource     = dept;
        RadioButtonList1.DataTextField  = "deptname";
        RadioButtonList1.DataValueField = "deptcode";
        RadioButtonList1.DataBind();
        RadioButtonList1.SelectedIndex = 0;
        List <int>     dis = sc.getdis(RadioButtonList1.SelectedValue);
        List <dynamic> disbursementitems = new List <dynamic>();

        foreach (int i in dis)
        {
            List <dynamic> disitem = sc.getdisbursementitems(i).ToList();
            disbursementitems.AddRange(disitem);
        }

        GridView1.DataSource = disbursementitems;
        GridView1.DataBind();

        if (GridView1.Rows.Count != 0)
        {
            //getallocations();

            GridView1.HeaderRow.Cells[4].Visible = false;

            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                GridView1.Rows[i].Cells[4].Visible = false;
            }
        }
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblUser.Text = Session["UserName"].ToString();



        if (Page.IsPostBack == false)
        {
            SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\OnilneTest.mdf;Integrated Security=True;User Instance=True");

            string str = "select * from Test_Master";

            SqlCommand cmd = new SqlCommand(str, con);

            con.Open();

            SqlDataReader dr;

            dr = cmd.ExecuteReader();

            RadioButtonList1.DataSource = dr;

            RadioButtonList1.DataTextField = "TestName";

            RadioButtonList1.DataValueField = "TestId";

            RadioButtonList1.DataBind();
        }
    }
Пример #7
0
        public void DataBindEx(bool bIncludeAll)
        {
            BLL.T_SystemInfo_BLL sysBLL = new T_SystemInfo_BLL();
            List<T_SystemInfo_MDL> sysList = sysBLL.GetModelList(" CurrentType='118' AND IsShow<>0");
            
            for (int i1 = 0; i1 < sysList.Count; i1++)
            {//颜色显示
                //sysList[i1].SystemInfoName = "<span style=\"background-color:" + sysList[i1].SystemInfoCode + "\">" + sysList[i1].SystemInfoName + "<span>";

                sysList[i1].SystemInfoName = "<span><span style=\"background-color:" + sysList[i1].SystemInfoCode + ";width:20px\">&nbsp;&nbsp;</span>" + sysList[i1].SystemInfoName + "</span>";

                //<div style="width: 8px; background-color: #00FF00; float: left;" />
            }

            if (bIncludeAll == true)
            {
                T_SystemInfo_MDL obj = new T_SystemInfo_MDL();
                obj.SystemInfoID = 0;
                //obj.SystemInfoCode = "";
                obj.SystemInfoName = "全部";
                sysList.Insert(0, obj);
            }

            RadioButtonList1.DataTextField = "SystemInfoName";
            RadioButtonList1.DataValueField = "SubType";
            RadioButtonList1.DataSource = sysList;
            RadioButtonList1.DataBind();
            if (sysList.Count > 0)
            {
                RadioButtonList1.Items[0].Selected = true;
            }           
        }
Пример #8
0
    protected void ddlRegions_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlRegions.SelectedValue != "0")
        {
            lblFeedback.Text = string.Empty;

            DataTable dt1 = new JpmmsClasses.BL.MainStreet().GetStreetsIRI();
            RadioButtonList1.Items.Clear();
            RadioButtonList1.Items.AddRange(new SharedClass().CreateRadioBtnSurveys(dt1.Rows[ddlRegions.SelectedIndex - 1][3].ToString()));
            RadioButtonList1.SelectedValue = dt1.Rows[ddlRegions.SelectedIndex - 1][2].ToString();
            RadioButtonList1.DataBind();

            gvRegionSamplesIRI.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsSampleDublicateIRI(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
            gvRegionSamplesIRI.DataBind();

            if (gvRegionSamplesIRI.Rows.Count > 0)
            {
                lblFeedback0.Text = string.Empty;
                DataTable  dt = new JpmmsClasses.BL.MainStreet().GetStreetsInfo(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
                DataColumn d  = new DataColumn("DublicateIRI");
                d.DefaultValue = gvRegionSamplesIRI.Rows.Count;
                dt.Columns.Add(d);
                gvRegionIRI.DataSource = dt;
                gvRegionIRI.DataBind();
            }
            else
            {
                lblFeedback0.Text      = Feedback.NoData();
                gvRegionIRI.DataSource = null;
                gvRegionIRI.DataBind();
            }
        }
    }
Пример #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Panel1.Visible = false;
         Panel2.Visible = false;
         for (int i = 2017; i < 2050; i++)
         {
             DropDownList2.Items.Add(i.ToString());
         }
         submodelid = (string)Session["submodel_id"];
         colorid    = (string)Session["colorid"];
         dml       ob = new dml();
         DataTable dt = new DataTable();
         dt = ob.get_detials(submodelid, colorid);
         if (dt.Rows.Count > 0)
         {
             Label2.Text = dt.Rows[0]["MODEL_NAME"].ToString();
             Label3.Text = dt.Rows[0]["SUBMODEL_NAME"].ToString();
             Label4.Text = dt.Rows[0]["TYPE_NAME"].ToString();
             Label5.Text = dt.Rows[0]["COLOR_NAME"].ToString();
             Label6.Text = dt.Rows[0]["PRICE"].ToString();
             double d = Double.Parse(dt.Rows[0]["EXPECTED_DAYS"].ToString());
             Label7.Text = Convert.ToString(Session["Adv"]);
             DateTime expdate = System.DateTime.Today.AddDays(d);
             Label1.Text = expdate.ToString("dd/MM/yyyy");
         }
         RadioButtonList1.DataSource     = ob.getPaymentDetails();
         RadioButtonList1.DataTextField  = "METHOD_NAME";
         RadioButtonList1.DataValueField = "METHOD_ID";
         RadioButtonList1.DataBind();
     }
 }
Пример #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     string[] automotiveTypeNames = Enum.GetNames(typeof(AutomotiveTypes));
     RadioButtonList1.RepeatDirection = RepeatDirection.Vertical;
     RadioButtonList1.DataSource      = automotiveTypeNames;
     RadioButtonList1.DataBind();
 }
Пример #11
0
        protected void FormPrepare()
        {
            switch (tab)
            {
            case 1:
                RadioButtonList1.DataSource     = AppEnum.GetGender();
                RadioButtonList1.DataTextField  = "value";
                RadioButtonList1.DataValueField = "key";
                RadioButtonList1.DataBind();
                District2.IsShowLatLng    = false;
                District2.IsShowOnlyChina = false;

                drpFateType.SelectedIndex  = drpFateType.Items.IndexOf(drpFateType.Items.FindByValue(m_user.FateType.ToString()));
                drpBirthType.SelectedIndex = drpBirthType.Items.IndexOf(drpBirthType.Items.FindByValue(m_user.IsShowBirth.ToString()));
                if (m_user.Birth != AppConst.DateTimeNull)
                {
                    DatePicker2.SelectedTime = m_user.Birth;
                }
                else
                {
                    DatePicker2.SelectedTime = new DateTime(1990, 1, 1);
                }
                if (m_user.HomeTown != AppConst.IntNull)
                {
                    District2.Area3SysNo = m_user.HomeTown;
                }
                if (m_user.Gender != AppConst.IntNull)
                {
                    RadioButtonList1.SelectedIndex = RadioButtonList1.Items.IndexOf(RadioButtonList1.Items.FindByValue(m_user.Gender.ToString()));
                }
                txtIntro.Text = m_user.Intro;
                break;
            }
        }
Пример #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        con.Open();
        cmd1 = new SqlCommand("select NEWID() as random, * from cexam order by NEWID();", con);

        SqlDataReader rd1 = cmd1.ExecuteReader();

        if (rd1.Read())
        {
            Label1.Text = rd1["qstn"].ToString();
        }
        con.Close();
        con.Open();
        str = Label1.Text.ToString();

        cmd3 = new SqlCommand("select qstn, optn from example;", con);
        RadioButtonList1.DataSource = cmd3.ExecuteReader();

        RadioButtonList1.DataTextField  = "optn";
        RadioButtonList1.DataValueField = "optn";

        RadioButtonList1.DataBind();

        con.Close();
    }
Пример #13
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            //開啟連線
            SqlConnection conn = new SqlConnection(data);

            if (Session["Order_ID"] == null)
            {
                Session["Order_ID"] = 0;
                conn.Open();
                //  可刪除訂單選項
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = "Del_Order";
                cmd.CommandType = CommandType.StoredProcedure;
                //宣告參數和給值
                cmd.Parameters.Add("@Customer_ID", SqlDbType.Int);
                cmd.Parameters["@Customer_ID"].Value = Session["ID"];
                cmd.Parameters.Add("@Order_ID", SqlDbType.Int);
                cmd.Parameters["@Order_ID"].Value = Session["Order_ID"];
                SqlDataReader dr = cmd.ExecuteReader();
                RadioButtonList1.DataSource    = dr;
                RadioButtonList1.DataTextField = "可以刪除的訂單編號";
                RadioButtonList1.DataBind();
                dr.Close();
                conn.Close();
            }

            /*           else
             *         {
             *             conn.Open();
             *             //  刪除訂單
             *             SqlCommand cmd = new SqlCommand();
             *             cmd.Connection = conn;
             *             cmd.CommandText = "Del_Order";
             *             cmd.CommandType = CommandType.StoredProcedure;
             *             //宣告參數和給值
             *             cmd.Parameters.Add("@Customer_ID", SqlDbType.Int);
             *             cmd.Parameters["@Customer_ID"].Value = Session["ID"];
             *             cmd.Parameters.Add("@Order_ID", SqlDbType.Int);
             *             cmd.Parameters["@Order_ID"].Value = Session["Order_ID"];
             *             cmd.ExecuteNonQuery();
             *             // 確認刪除狀況
             *             SqlCommand cmd_1 = new SqlCommand();
             *             cmd_1.Connection = conn;
             *             cmd_1.CommandText = "Check_Del_Order";
             *             cmd_1.CommandType = CommandType.StoredProcedure;
             *             //宣告參數和給值
             *             cmd_1.Parameters.Add("@Customer_ID", SqlDbType.Int);
             *             cmd_1.Parameters["@Customer_ID"].Value = Session["ID"];
             *             cmd_1.Parameters.Add("@Order_ID", SqlDbType.Int);
             *             cmd_1.Parameters["@Order_ID"].Value = Session["Order_ID"];
             *             SqlDataReader dr_1 = cmd_1.ExecuteReader();
             *             GridView2.DataSource = dr_1;
             *             GridView2.DataBind();
             *             dr_1.Close();
             *             conn.Close();
             *         }
             */
        }
Пример #14
0
    protected void ddlMainStreets_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        DataTable dtx = new JpmmsClasses.BL.MainStreet().GetStreetsAssets();

        RadioButtonList1.Items.Clear();
        RadioButtonList1.Items.AddRange(new SharedClass().CreateRadioBtnSurveys(dtx.Rows[ddlMainStreets.SelectedIndex - 1][3].ToString()));
        RadioButtonList1.SelectedValue = dtx.Rows[ddlMainStreets.SelectedIndex - 1][2].ToString();
        RadioButtonList1.DataBind();
    }
Пример #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var results = from r in db.Category
                       select r;
         RadioButtonList1.DataSource = results;
         RadioButtonList1.DataBind();
     }
 }
Пример #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     RadioButtonList1.DataSource     = BusinessLogic.ListSize();
     RadioButtonList1.DataTextField  = "Description";
     RadioButtonList1.DataValueField = "ID";
     RadioButtonList1.DataBind();
     DropDownList1.DataSource     = BusinessLogic.ListFood();
     DropDownList1.DataTextField  = "Name";
     DropDownList1.DataValueField = "ID";
     DropDownList1.DataBind();
 }
Пример #17
0
        //加载交易类型
        protected void loadtradeType()
        {
            DataTable dt     = new DataTable();
            string    sqlCmd = "select * from t_trade_tradeType";

            SqlSel.GetSqlSel(ref dt, sqlCmd);
            RadioButtonList1.DataTextField  = "tradeName";
            RadioButtonList1.DataValueField = "id";
            RadioButtonList1.DataSource     = dt;
            RadioButtonList1.DataBind();
        }
Пример #18
0
        public void radio()
        {
            SqlDataAdapter da = new SqlDataAdapter("select Assento from Lugar", con);
            DataTable      dt = new DataTable();

            da.Fill(dt);
            RadioButtonList1.DataTextField  = "Assento";
            RadioButtonList1.DataValueField = "Assento";
            RadioButtonList1.DataSource     = dt;
            RadioButtonList1.DataBind();
        }
Пример #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         RadioButtonList1.DataSource     = bizlogic.ListCategory();
         RadioButtonList1.DataTextField  = "Name";
         RadioButtonList1.DataValueField = "CategoryID";
         RadioButtonList1.DataBind();
         StatusLabel.Text = " ";
     }
 }
Пример #20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DataClasses1DataContext Pet = new DataClasses1DataContext();
         var data = Pet.Category.Select(p => p);
         RadioButtonList1.DataTextField  = "Name";
         RadioButtonList1.DataValueField = "CategoryId";
         RadioButtonList1.DataSource     = data;
         RadioButtonList1.DataBind();
     }
 }
        void BindGenders()
        {
            List <string> gendersList = new List <string>();

            gendersList.Add("Erkek");
            gendersList.Add("Kadın");

            RadioButtonList1.DataSource = gendersList;
            RadioButtonList1.DataBind();

            RadioButtonList1.SelectedIndex = 0;
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("databaseConnectionString");

        con.Open();
        string        s   = "select opn1,opn2,opn3,opn4 from gre_test";
        SqlCommand    cmd = new SqlCommand(s, con);
        SqlDataReader rd;

        rd = cmd.ExecuteReader(CommandBehavior.CloseConnection);

        RadioButtonList1.DataSource = rd;
        RadioButtonList1.DataBind();
    }
Пример #23
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (Session["Start_Date"] == null)
     {
         Label5.Text = ("請選擇訂房日期");
     }
     else if (Session["End_Date"] == null)
     {
         Label5.Text = ("請選擇退房日期");
     }
     else
     {
         Session["Sort"] = 'D';
         //開啟連線
         SqlConnection conn = new SqlConnection(data);
         conn.Open();
         // 查詢可用的房型
         SqlCommand cmd = new SqlCommand();
         cmd.Connection  = conn;
         cmd.CommandText = "Query_Room";
         cmd.CommandType = CommandType.StoredProcedure;
         //宣告參數和給值
         cmd.Parameters.Add("@Start_Date", SqlDbType.DateTime);
         cmd.Parameters["@Start_Date"].Value = Session["Start_Date"];
         cmd.Parameters.Add("@End_Date", SqlDbType.DateTime);
         cmd.Parameters["@End_Date"].Value = Session["End_Date"];
         cmd.Parameters.Add("@Sort", SqlDbType.NVarChar);
         cmd.Parameters["@Sort"].Value = Session["Sort"];
         SqlDataReader dr = cmd.ExecuteReader();
         GridView1.DataSource = dr;
         GridView1.DataBind();
         dr.Close();
         // 房型選項
         SqlCommand cmd_1 = new SqlCommand();
         cmd_1.Connection  = conn;
         cmd_1.CommandText = "Query_Room_List";
         cmd_1.CommandType = CommandType.StoredProcedure;
         //宣告參數和給值
         cmd_1.Parameters.Add("@Start_Date", SqlDbType.DateTime);
         cmd_1.Parameters["@Start_Date"].Value = Session["Start_Date"];
         cmd_1.Parameters.Add("@End_Date", SqlDbType.DateTime);
         cmd_1.Parameters["@End_Date"].Value = Session["End_Date"];
         SqlDataReader dr_1 = cmd_1.ExecuteReader();
         RadioButtonList1.DataSource    = dr_1;
         RadioButtonList1.DataTextField = "Type";
         RadioButtonList1.DataBind();
         dr_1.Close();
         conn.Close();
     }
 }
Пример #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DropDownList1.DataSource     = bs_logic.ListFood();
                DropDownList1.DataTextField  = "Name";
                DropDownList1.DataValueField = "ID";
                DropDownList1.DataBind();

                RadioButtonList1.DataSource     = bs_logic.ListSize();
                RadioButtonList1.DataTextField  = "Description";
                RadioButtonList1.DataValueField = "ID";
                RadioButtonList1.DataBind();
            }
        }
Пример #25
0
 private void loadFlowInfo(string formName, string userId)
 {
     try
     {
         DataTable dt = validFlow(formName, userId);
         RadioButtonList1.DataTextField  = "flowName";
         RadioButtonList1.DataValueField = "id";
         RadioButtonList1.DataSource     = dt;
         RadioButtonList1.DataBind();
     }
     catch (Exception ex)
     {
         Alert.ShowInTop(ex.Message);
     }
 }
Пример #26
0
    protected void Button6_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();

        dt.Columns.Add("texts");
        dt.Columns.Add("values");
        dt.Rows.Add("松坂肉", "松坂肉.90");
        dt.Rows.Add("鹽烤風螺", "鹽烤風螺.90");
        RadioButtonList1.DataSource     = dt;
        RadioButtonList1.DataValueField = "values";
        RadioButtonList1.DataTextField  = "texts";
        RadioButtonList1.DataBind();
        LbPrice.Text    = "均一價90元";
        Image1.ImageUrl = "";
        // SetRadioList(dt);
    }
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                using (projectEntities1 context = new projectEntities1())
                {
                    RadioButtonList1.DataSource = (from m0 in context.Movie_Info
                                                   join s0 in context.Show_Info on m0.Movie_Id equals s0.Movie_Id
                                                   join t0 in context.Theater_Info on s0.Theater_Id equals t0.Theater_Id
                                                   where t0.Location == DropDownList1.SelectedItem.Text
                                                   select m0.Movie_Name).ToList().Distinct();

                    RadioButtonList1.DataBind();
                }
            }
        }
Пример #28
0
    private void filltable()
    {
        string        cs    = WebConfigurationManager.ConnectionStrings["sag"].ConnectionString;
        SqlConnection con   = new SqlConnection(cs);
        string        query = "select empno,empname from emp";
        SqlCommand    cmd   = new SqlCommand(query, con);

        dt = new DataTable();
        SqlDataAdapter adap = new SqlDataAdapter(cmd);

        adap.Fill(dt);
        RadioButtonList1.DataSource     = dt;
        RadioButtonList1.DataTextField  = "empname";
        RadioButtonList1.DataValueField = "empno";
        RadioButtonList1.DataBind();
    }
Пример #29
0
        private void BindRadioButtonList1()
        {
            List <TestClass> myList = new List <TestClass>();

            myList.Add(new TestClass("value1", "数据绑定值 1"));
            myList.Add(new TestClass("value2", "数据绑定值 2"));
            myList.Add(new TestClass("value3", "数据绑定值 3"));
            myList.Add(new TestClass("value4", "数据绑定值 4"));

            RadioButtonList1.DataTextField  = "Name";
            RadioButtonList1.DataValueField = "Id";
            RadioButtonList1.DataSource     = myList;
            RadioButtonList1.DataBind();

            RadioButtonList1.SelectedValue = "value3";
        }
Пример #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string         sql   = "select sCauhoi,sDapan1,sDapan2,sDapan3,sDapan4 from tblCauhoi";
            SqlCommand     sql1  = new SqlCommand(sql, cnn);
            SqlDataAdapter sql11 = new SqlDataAdapter(sql1);
            DataTable      da    = new DataTable();

            sql11.Fill(da);
            RadioButtonList1.DataValueField = "sCauhoi";
            RadioButtonList1.DataSource     = da;
            RadioButtonList1.DataBind();

            //Label1.Text = da.Rows[0][0].ToString();
            //RadioButtonList1.Items.Add(da.Rows[0][1].ToString());
            //RadioButtonList1.Items.Add(da.Rows[0][2].ToString());
            //RadioButtonList1.Items.Add(da.Rows[0][3].ToString());
            //RadioButtonList1.Items.Add(da.Rows[0][4].ToString());
        }