public void BindGrid()
        {
            if (Request.QueryString["inv_n"] == null)
            {
                Response.Redirect("inv_index.aspx");
            }
            else
            {
                int inv_n = Convert.ToInt16(Request.QueryString["inv_n"]);
                Maticsoft.BLL.inv_que que_bll = new BLL.inv_que();
                GridView1.DataSource = que_bll.GetList("[que_n_id] = " + inv_n);
                GridView1.DataBind();

                foreach (GridViewRow row in GridView1.Rows)
                {
                    int    id    = Convert.ToInt16(((Label)row.FindControl("id_Label")).Text);
                    string style = ((Label)row.FindControl("style_Label")).Text.Trim();
                    if (style == "单选题")
                    {
                        ((RadioButtonList)row.FindControl("RadioButtonList1")).Visible = true;
                        ((TextBox)row.FindControl("TextBox1")).Visible = false;
                        Maticsoft.BLL.inv_option opt_bll = new BLL.inv_option();
                        ((RadioButtonList)row.FindControl("RadioButtonList1")).DataSource     = opt_bll.GetList("que_id = " + id);
                        ((RadioButtonList)row.FindControl("RadioButtonList1")).DataTextField  = "text";
                        ((RadioButtonList)row.FindControl("RadioButtonList1")).DataValueField = "id";
                        ((RadioButtonList)row.FindControl("RadioButtonList1")).DataBind();
                    }
                    else if (style == "问答题")
                    {
                        ((RadioButtonList)row.FindControl("RadioButtonList1")).Visible = false;
                        ((TextBox)row.FindControl("TextBox1")).Visible = true;
                    }
                }
            }
        }
예제 #2
0
 public void loaddata()
 {
     Maticsoft.BLL.inv_que que_bll = new BLL.inv_que();
     inv_que.DataSource     = que_bll.GetList("");
     inv_que.DataTextField  = "text";
     inv_que.DataValueField = "id";
     inv_que.DataBind();
 }