Example #1
0
        private void BindParameterData(int cateid)
        {
            DataTable dt         = pBll.GetList("cateid = " + cateid + " and paratype=" + (int)CategoryParameterType.检索属性).Tables[0];
            DataTable ValueTable = pvBll.GetList(" productid = " + ProductID).Tables[0];

            Hashtable vtable = new Hashtable();

            foreach (DataRow row in ValueTable.Rows)
            {
                vtable.Add(Convert.ToInt32(row["paraid"]), row["paravalue"]);
            }

            GridView_Parameter.DataSource = dt;
            GridView_Parameter.DataBind();

            for (int i = 0; i < GridView_Parameter.Rows.Count; i++)
            {
                RadioButtonList ValueList     = ((RadioButtonList)GridView_Parameter.Rows[i].Cells[1].FindControl("RadioList_ParameterValue"));
                string          SelectedValue = String.Empty;

                if (vtable[Convert.ToInt32(dt.Rows[i]["paraid"])] != null)
                {
                    SelectedValue = vtable[Convert.ToInt32(dt.Rows[i]["paraid"])].ToString();
                }
                string[] Values = dt.Rows[i]["paravalues"].ToString().Split(',');

                for (int j = 0; j < Values.Length; j++)
                {
                    ListItem item = new ListItem();

                    item.Text  = Values[j];
                    item.Value = j.ToString();

                    if (item.Text == SelectedValue)
                    {
                        item.Selected = true;
                    }

                    ValueList.Items.Add(item);
                }
            }
        }
        private void BindParameterData()
        {
            DataTable dt = pBll.GetList("cateid = " + CategoryID + " and paratype=" + (int)CategoryParameterType.检索属性).Tables[0];

            GridView_Parameter.DataSource = dt;
            GridView_Parameter.DataBind();

            for (int i = 0; i < GridView_Parameter.Rows.Count; i++)
            {
                RadioButtonList ValueList = ((RadioButtonList)GridView_Parameter.Rows[i].Cells[1].FindControl("RadioList_ParameterValue"));
                string[]        Values    = dt.Rows[i]["paravalues"].ToString().Split(',');
                for (int j = 0; j < Values.Length; j++)
                {
                    ListItem item = new ListItem();

                    item.Text  = Values[j];
                    item.Value = j.ToString();

                    ValueList.Items.Add(item);
                }
            }
        }
Example #3
0
        private void BindData(int CategoryID)
        {
            DataTable dt = bll.GetList("cateid=" + (CategoryID == -1?0:CategoryID)).Tables[0];

            if (dt.Rows.Count > 0)
            {
                GridView1.DataSource = dt;
                GridView1.DataBind();
                Label_Informer.Text = String.Empty;
            }
            else
            {
                GridView1.DataSource = new DataTable();
                GridView1.DataBind();
                Label_Informer.Text = "该分类暂无属性";
            }
        }