悬赏园豆:5
[已解决问题]
解决于 2008-04-24 16:52
<P> 请看下面,下面是怎么会事?</P>
<P>在下面的中DropDownList1上绑定了数据。</P>
<P>protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)<BR> {<BR> if (e.Row.RowType ==DataControlRowType.DataRow)<BR> {<BR> DataSet Ds = new DataSet();<BR> DropDownList ddl = (DropDownList)e.Row.FindControl("DropDownList1");<BR> string Name = "GetBooks";//存储过程名字<BR> int strWhere = 0;//表示查询条件为空</P>
<P> //访问类库的Sql静态方法<BR> Ds = DB.GetList(Name, strWhere);<BR> if (Ds.Tables[0].Rows.Count != 0)<BR> {<BR> ///绑定数据<BR> ddl.DataSource = Ds;<BR> ddl.DataTextField = "AuthorName";<BR> ddl.DataValueField = "AuthorName";<BR> }</P>
<P> // Button btnDel = (Button)e.Row.FindControl("btndel");<BR> // btnDel.Attributes.Add("onclick", "return confirm('真的要删除吗?')");<BR> }<BR> }</P>
<P>在下面的中DropDownList1上绑定不了数据。</P>
<P>protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)<BR> {<BR> if (e.Row.RowType == DataControlRowType.DataRow)<BR> {<BR> ////DataSet Ds = new DataSet();<BR> ////DropDownList ddl = (DropDownList)e.Row.FindControl("DropDownList1");<BR> ////string Name = "GetBooks";//存储过程名字<BR> &