首页 新闻 会员 周边 捐助

updatepanel 中trigger问题

0
悬赏园豆:10 [已关闭问题] 关闭于 2008-07-14 09:42
<P>最近在updatepanel中放了个tabpanel</P> <P>tabpanel中放置了一个Id为button1的button,在updatepanel中增加了postbacktrigger的controlid就指向了button1,但是页面加载的时候老是出错,提示找不到button1,这是什么问题</P>
问题补充: 前台代码如下: <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"> <cc1:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1"> <ContentTemplate> <asp:LinkButton ID="PopupBtn" OnClick="PopupBtn_Click" runat="server" Text="测试"></asp:LinkButton> </ContentTemplate> </cc1:TabPanel> </cc1:TabContainer> </ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="PopupBtn" /> </Triggers> </asp:UpdatePanel> </form> Server Error in '/' Application. -------------------------------------------------------------------------------- A control with ID 'Button1' could not be found for the trigger in UpdatePanel 'UpdatePanel1'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: A control with ID 'Button1' could not be found for the trigger in UpdatePanel 'UpdatePanel1'. Source Error: An unhand
dsr456的主页 dsr456 | 初学一级 | 园豆:135
提问于:2008-07-10 17:54
< >
分享
所有回答(2)
0
你看你的代码中是否添加了<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>;还有像这种情况最好把错误帖出来
金鱼 | 园豆:1090 (小虾三级) | 2008-07-10 21:40
0
updatepanel中的服务端控件在提交更新后会丢失事件,后台也会提示找不到控件。 我的作法是在updatepanel中增加一个Panel控件: <asp:Panel ID="Panel_ClickLine" runat="server"> </asp:Panel> 再在cs代码,中页面初始化的地方加入: Button mybt_all_Click = new Button(); mybt_all_Click.Text = "-全部数据-"; mybt_all_Click.CommandArgument = string.Format("~/Chart/GameCategoryClickLine.aspx?AreaID={0}&CategoryID={1}&GameID={2}&p={3}&t={4}", AreaID, CategoryID, GameID, 1, WeekNumOverall - 34); mybt_all_Click.Click += new EventHandler(mybt_all_Click_Click); Panel_ClickLine.Controls.Add(mybt_all_Click); 来动态加入这个button控件,下面是它的事件: void mybt_all_Click_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(1000); Button bt = (Button)sender; Image_Click.ImageUrl = bt.CommandArgument; }
风海迷沙 | 园豆:4453 (老鸟四级) | 2008-07-11 11:57
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册