页面上有两个用户控件,上面是包含刷新等按钮的工具栏,下面是一个datagrid
我希望datagrid能定时刷新,使用了updatepanel,但是无论是手动刷新还是定时刷新,页面都会postback,下面是主要代码
main.aspx:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering=true></asp:ScriptManager>
<uc2:ToolBar id="ToolBar1" runat="server"></uc2:ToolBar> --这就是那个按钮列
<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td valign="top" rowspan="2">
<asp:UpdatePanel runat=server ID = "UpdatePanelForPH">
<Triggers>
<asp:AsyncPostBackTrigger ControlID=ToolBar1 />
</Triggers>
<ContentTemplate>
<asp:placeholder id="placeHolder" runat="server"> --这里放置datagrid
</asp:placeholder>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
tasklist.ascx
<asp:ScriptManagerProxy runat=server ID="scriptManagerProxy1"></asp:ScriptManagerProxy>

<asp:Timer ID="timer1" runat=server Interval=10000 ontick="timer1_Tick"></asp:Timer>
<table width="100%">
<tr>
<td width="100%">
<asp:UpdatePanel runat=server ID="updatePanel1">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:datagrid id="gridList" AllowSorting="True" runat="server" AutoGenerateColumns="False"
AllowPaging="True" Width="100%" BorderStyle="None" BorderColor="#A6A6A6">
<HeaderStyle Font-Names="Arial" HorizontalAlign="Center" ForeColor="Black" VerticalAlign="Middle"
BackColor="#F7F7F7"></HeaderStyle>
<PagerStyle NextPageText="" PrevPageText="" Visible="false"></PagerStyle>
</asp:datagrid>
</ContentTemplate>
</asp:UpdatePanel>
toolbar.ascx:
<asp:DropDownList ID="ddlState" runat=server AutoPostBack=true OnSelectedIndexChanged="ddlState_SelectedIndexChanged" ForeColor=#012E8C></asp:DropDownList>  
<tra:LinkButton id="refurbish" runat="server" CausesValidation="false" TextKey="OA_TASKCENTER_REFURBISH" Text="刷新" ForeColor=#012E8C></tra:LinkButton>
请各位大虾帮我看看,马上给分
把按钮放外面,updatepanel控制不了。viewstate是不是被你禁用了?
你做一个简单的测试,做一个测试页面,
放一个updatepanel,里面放一个button,看是不是无刷新的。updatepanel
如果不是的话,说明你配置有问题,否则是页面的问题我的方法是可以帮你的:
把你的button在放另一个UpdatePanel
后台
感觉有点乱。不过楼主可以试试UpdateMode="Conditional"这个属性,父UpdatePanel与子UpdatePanel的这个属性组合测试下把按钮 gridview 放入updatepanel楼主尝试一下做法:
updatepanel属性
ChildrenAsTriggers="false" UpdateMode="Conditional"
这样你的UpdatePanel只能根据你的触发器才能提交你把所有的按钮和控件都放到UpdatePanel中,如果想实现定时刷新的话,你可以再写一个timer时间定时多长时间刷新页面一次!!
把按钮放外面,updatepanel控制不了。
viewstate是不是被你禁用了?
你做一个简单的测试,做一个测试页面,
放一个updatepanel,里面放一个button,看是不是无刷新的。updatepanel
如果不是的话,说明你配置有问题,否则是页面的问题
我的方法是可以帮你的:
把你的button在放另一个UpdatePanel
后台
感觉有点乱。不过楼主可以试试UpdateMode="Conditional"这个属性,父UpdatePanel与子UpdatePanel的这个属性组合测试下
把按钮 gridview 放入updatepanel
楼主尝试一下做法:
updatepanel属性
ChildrenAsTriggers="false" UpdateMode="Conditional"
这样你的UpdatePanel只能根据你的触发器才能提交
你把所有的按钮和控件都放到UpdatePanel中,如果想实现定时刷新的话,你可以再写一个timer时间定时多长时间刷新页面一次!!
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-37213-1.html
改变不了了
放心找不到老婆的不是我了
吹牛逼吧