[英]UpdatePanel in each datalist row
I am trying to update each DataList row without having to PostBack the entire DataList. 我正在尝试更新每个DataList行,而不必回发整个DataList。
Basically I want to go with 基本上我想和
<DataList>
<ItemTemplate>
<UpdatePanel>
</UpdatePanel>
</ItemTemplate>
</DataList>
instead of 代替
<UpdatePanel>
<DataList>
<ItemTemplate>
</ItemTemplate>
</DataList>
</UpdatePanel>
Is this possible, or better - does it make any sense? 这是可能的,还是更好的-有任何意义吗?
Yes , It is possible, I personally do that in some situation. 是的 ,有可能,我个人在某些情况下会这样做。
But you must be aware that with an UpdatePanel is not a perfect solution. 但是您必须意识到,使用UpdatePanel并不是一个完美的解决方案。 As an example, the client sent the complete ViewState of the page.
例如,客户端发送了页面的完整ViewState。 So there will be a gain, but not as big as you might expect.
因此会有收益,但没有您预期的那么大。
I suggest you to read the UpdatePanel Considerations section in this link for more information. 建议您阅读此链接中的“ UpdatePanel注意事项”部分以获取更多信息。
Update : 更新:
You must also watch how you setup you template, example : you cannot put a table row in a update panel. 您还必须注意如何设置模板,例如:您不能在更新面板中放置表格行。
Don't do this : 不要这样做:
<asp:DataList>
<HeaderTemplate>
<Table>
</HeaderTemplate>
<ItemTemplate>
<UpdatePanel>
<tr>
<td>...</td>
<td>...</td>
</tr>
</UpdatePanel>
</ItemTemplate>
<FooterTemplate>
</Table>
</FooterTemplate>
</asp:DataList>
But you cant do : 但是你不能做:
<asp:DataList>
<HeaderTemplate>
<Table>
</HeaderTemplate>
<ItemTemplate>
<UpdatePanel>
<tr>
<td>
<UpdatePanel>
...
</UpdatePanel>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</Table>
</FooterTemplate>
</asp:DataList>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.