protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            int cloID = Request.QueryString["cloID"] == null ? 0 : Int32.Parse(Request.QueryString["cloID"]);

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //Get questionID here
                String tableName         = DataBinder.Eval(e.Item.DataItem, "tableName").ToString();
                String pkColumnName      = DataBinder.Eval(e.Item.DataItem, "pkColumnName").ToString();
                String displayColumn     = DataBinder.Eval(e.Item.DataItem, "displayColumn").ToString();
                String headingLabel      = DataBinder.Eval(e.Item.DataItem, "headingLabel").ToString();
                String questionStatement = DataBinder.Eval(e.Item.DataItem, "questionStatement").ToString();
                int    questionID        = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "questionID"));

                DropDownList DropDownList1 = (DropDownList)e.Item.FindControl("ddlItemTemp");

                DBQueDao        dbQueDaoObj = new DBQueDao();
                List <ListItem> ddValueList = dbQueDaoObj.getColumnValues(tableName, displayColumn);

                DropDownList1.DataSource     = ddValueList;
                DropDownList1.DataTextField  = "Text";
                DropDownList1.DataValueField = "Value";
                DropDownList1.DataBind();
            }
        }
Ejemplo n.º 2
0
        public void fillSelectedColumnValues(DropDownList ddWhereTable, DropDownList ddWhereColumn, DropDownList ddColumnValue)
        {
            String          tableName      = ddWhereTable.SelectedItem.Text;
            String          pkColumnName   = ddWhereTable.SelectedItem.Value;
            String          columnSelected = ddWhereColumn.SelectedItem.Text;
            DBQueDao        dbQueDaoObj    = new DBQueDao();
            List <ListItem> listItems      = dbQueDaoObj.getColumnValues(tableName, columnSelected);

            fillColumnValueList(ddColumnValue, listItems);
        }