首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

datalist ItemDataBound绑定数据后没有值,多谢帮忙

2011-12-15 
datalist ItemDataBound绑定数据后没有值,急急,,谢谢帮忙!privatestringTestPaperID tiku3 //试卷号//

datalist ItemDataBound绑定数据后没有值,急急,,谢谢帮忙!
private   string   TestPaperID= "tiku3 ";//试卷号
        //private   string   TestPaperName;//试卷号
        private   int   RecorderCount=0;//总记录数
        private   int   pageID=1;//当前页号
        private   int   PageSize=10;//每页记录数
        private   int   pageCount=20;//返回总记录数
        private   int   TotalPageCount=3;//返回总页数


        Title   title   =   new   Title();
        protected   void   Page_Load(object   sender,   EventArgs   e)
        {
                if   (!IsPostBack)
                {


                        Bind();

                        //string   option;
                        //option=
                     

                }
        }


        private   void   Bind()
        {

                //int   id   =   4;

                title.BindTitleList(DataList1,   TestPaperID,RecorderCount,   pageID,   PageSize,   pageCount,   TotalPageCount);

                //   去数据库取该页对应的数据
                //循环该数据集,对每行(每道题),取提号,提干,OPTION
                //提号,提干“直接”显示在页面上,OPTION用SPLIT截取
                //循环OPTION数组,将每个OPTION加载到RADIO
        }
        protected   void   DataList1_ItemDataBound(object   sender,   DataListItemEventArgs   e)
        {
                //if   (e.Item.ItemType   ==   ListItemType.AlternatingItem   ||   e.Item.ItemType   ==   ListItemType.Item)
                //{

                        //RadioButtonList   rbl   =   e.Item.FindControl( "rblTitle ");

                        Literal   ll   =   (Literal)e.Item.FindControl( "llHtml ");

                        Label   lblid   =   (Label)e.Item.FindControl( "lblTitleId ");
                        Label   lbl=(Label)e.Item.FindControl( "lbloption ");

                        //string   option;
                        //option   =   lbl.Text;



                        string[]   s   =   lbl.Text.Split( '| ');

                        string   ii   =   lblid.Text;

                        string   html   =   " ";
                        string[]   zz   =   new   string[]   {   " ",   "A ",   "B ",   "C ",   "D ",   "E ",   "F ",   "G ",   "H "   };
                        for   (int   i   =   1;   i   <=   s.Length;   i++)
                        {
                                html   +=   " <INPUT   type=\ "radio\ "   value=\ "1\ "   name=\ "sele "   +   lblid.Text   +   "\ "   ID=\ "Radio "   +   lblid.Text   +   "_ "   +   zz[i].ToLower()   +   "\ "   onclick=\ "dati( "   +   lblid.Text   +   ", ' "   +   (i   -   1)   +   " ');\ "> "   +   zz[i]   +   ". "   +   s[i   -   1]   +   " <br> ";
                       
                       
                       
                        }
                               
                                ll.Text   =   html;
                       

                //}
        }

[解决办法]
RadioButtonList rbl = (RadioButtonList)e.Item.FindControl( "rblTitle ");

热点排行