向DropDownList
添加EditItemTemplate
时出现此错误:
Failed to load viewstate.
The control tree into which viewstate is being loaded must match
the control tree that was used to save viewstate during the previous request.
For example, when adding controls dynamically, the controls added during a post-back.
我正在对RowDataBound事件中的代码进行绑定。如何在此处正确添加此控件?
答案 0 :(得分:0)
尝试将数据绑定到gridview,只有当它不是回传时,
....
protected void Page_Load(object sender, EventArgs e)
{
...
If(!Page.IsPostBack)
{
......
gridview.DataBind();
.....
}
...
}