C# ListView中的ASP.NET控件在.NET 4.5中的部分回发早期进行数据绑定
我有一个ASP.Net ListView控件,该ListView中的控件的数据绑定顺序有问题。简短的问题是,在部分回发中,listview InsertItemTemplate中的dropdownlist在listview之前进行数据绑定,从而导致问题。在我们的.NET3.5代码中,它似乎运行良好,为什么会发生这种情况 一些背景:我们已经安装了我们的软件,并在.NET3.5中运行,并且运行良好。我们正在迁移到.NET4.5,遇到了一些问题。我们有一个控件,类似于下面的控件,在第一次加载时可以很好地加载。但是,在第一次加载之后,如果我单击其中一个编辑按钮,DropDownList数据绑定将先于ListViewC# ListView中的ASP.NET控件在.NET 4.5中的部分回发早期进行数据绑定,c#,asp.net,C#,Asp.net,我有一个ASP.Net ListView控件,该ListView中的控件的数据绑定顺序有问题。简短的问题是,在部分回发中,listview InsertItemTemplate中的dropdownlist在listview之前进行数据绑定,从而导致问题。在我们的.NET3.5代码中,它似乎运行良好,为什么会发生这种情况 一些背景:我们已经安装了我们的软件,并在.NET3.5中运行,并且运行良好。我们正在迁移到.NET4.5,遇到了一些问题。我们有一个控件,类似于下面的控件,在第一次加载时可以很好
<asp:ListView ID="ListView_Temp" runat="server" DataSourceID="ObjectDataSource_TempBLL"
DataKeyNames="Id”" InsertItemPosition="FirstItem"
OnDataBinding="ListView_Temp_DataBinding">
<LayoutTemplate>
<table id="itemPlaceholderContainer" runat="server">
<tr id="tr_Header">
<th></th>
<th>Name
</th>
<th></th>
</tr>
<tr id="itemPlaceholder">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr id="tr_Item" runat="server">
<td>
<asp:LinkButton ID="LinkButton_Edit" runat="server" CommandName="Edit">Edit</asp:LinkButton>
</td>
<td>
<asp:Label ID="Label_Name" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
</td>
<td></td>
</tr>
</ItemTemplate>
<InsertItemTemplate>
<tr>
<td>
<asp:LinkButton ID="LinkButton_Insert" runat="server" CommandName="Insert" ValidationGroup="TempInsert">Add</asp:LinkButton>
</td>
<td>
<asp:DropDownList ID="DropDownList_Names" runat="server" DataSourceID="ObjectDataSource_Names" DataTextField="Names"
DataValueField="NameId" OnDataBinding="DropDownList_Names_DataBinding">
</asp:DropDownList>
</td>
<td></td>
</tr>
</InsertItemTemplate>
<EditItemTemplate>
<tr>
<td>
<asp:LinkButton ID="LinkButton_Update" runat="server" CommandName="Update">Update</asp:LinkButton>
<asp:LinkButton ID="LinkButton_Cancel" runat="server" CommandName="Cancel">Cancel</asp:LinkButton>
</td>
<td>
<asp:Label ID="Label_Name" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
</td>
<td>
<asp:LinkButton ID="LinkButton_Delete" runat="server" CommandName="Delete">Delete</asp:LinkButton>
</td>
</tr>
</EditItemTemplate>
<EmptyDataTemplate>
<table id="Table1" runat="server">
<tr>
<td>No Names are specified.
</td>
</tr>
</table>
</EmptyDataTemplate>
名称
编辑
添加
更新
取消
删除
没有指定任何名称。
在.NET3.5代码中,调用ListView数据绑定方法,然后调用DropDownList数据绑定方法。
我想知道是否有人已经看到了这一点,有任何解决方案,甚至在这一点上的建议
以下是我们测试过的一些东西
1) 正在删除DropDownList的ObjectDataSource。(DropDownList仍然是数据绑定的)
2) 从有问题的dropdownlist中剥离尽可能多的属性/方法/属性,它仍然是数据绑定的。
3) 完全停止了对dropdownlist的数据绑定,只添加了一个shell DDL,它仍然运行数据绑定事件/方法。
4) 添加其他控件类型(单选按钮、网格视图)以查看它是否是DDL独有的,它们也会进行数据绑定
如有任何帮助或见解,将不胜感激
注意:我们刚刚发现,如果关闭ListView的ViewState,则不会发生此数据绑定。这可能会引导我们找到一个解决方案,但我想了解并查看有关此更改和/或更改原因的文档