<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager<asp:UpdatePanel ID="UpdatePanel1"runat="server">
<ContentTemplate>
<asp:Timer runat="server" ID="Timer2" Interval="60" ontick="Timer1_Tick"/>
<asp:DataList ID="DataList1" runat="server" RepeatColumns="1" onitemcommand="DataList1_ItemCommand">
<ItemTemplate>
<b>Test Name:</b> <%# DataBinder.Eval(Container.DataItem, "Name")%> <br />
<b>Test Phone:</b> <%# DataBinder.Eval(Container.DataItem, "Phone")%> <br />
<asp:LinkButton ID="btnView" runat="server" Text="View" CommandName="ShowDetails" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Name")%>' OnCommand="btnView_Command"></asp:LinkButton>
</ItemTemplate>
</asp:DataList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
<asp:Panel ID="panel2" runat="server" Visible="false"></asp:Panel>
Code Behind :
protected void dlBundleRequests_ItemCommand(object source, DataListCommandEventArgs e)
{
panel1.Visible = false;
panel2.Visible = true;
if (e.CommandName == "ShowDetails")// null)
{
Session["Name"] = e.CommandArgument.ToString();
//Show Panel2
}
}
protected void Timer1_Tick(object sender, EventArgs e)
{
//Binding DataList1
}
protected void btnView_Command(Object sender, CommandEventArgs e)
{
//set visibility true for Panel2
}
添加更新面板和计时器控件的必要性是每5分钟自动刷新一次datalist1。请帮我解决这个问题。添加这两个控件后,链接按钮停止工作。