在DataGrid 中用了内置的 Edit,Cancel,Update 按钮用户控件为一个DropDownList,动态绑定到数据库
private void Page_Load(object sender, System.EventArgs e)
{
   if (!IsPostBack)
   {
     DropDownList 相关数据绑定
   }
}
每次页面加载时 DropDownList 相关数据绑定执行了,显示的数据正常但是当点Edit按钮进行 Update时, 
DropDownlist 相关数据绑定没有执行, 所以DropDownList的内容就为空了我想问题可能与.net 页面处理机制有关,当点Edit按钮是一次Postback ,所以"DropDownList 相关数据绑定"没有执行, 但是如果不用 if (!IsPostBack) 这句, DropDownList的选项就不能选定请问,如何才能让DropDownList 的内容正常显示

解决方案 »

  1.   

    应改不存在问题的
    页面第一次运行加载时:!IsPostBack为true
    执行了“DropDownList 相关数据绑定”
    当你再点DataGrid 中内置的 Edit,Cancel,Update 按钮时,DropDownList已经有数值了 DropDownList的选项也可以取到的
      

  2.   

    首先谢谢你但是我本机上确实是再点DataGrid 中内置的 Edit后DropDownList就没有任何数据了啊
      

  3.   

    绑定的代码贴出来看看。
    是这样的形式么?
    Control ctrl =  Page.LoadControl("WebUserControl1.ascx");
    this.Controls.Add(ctrl);