I have a ASP.NET Web Application using VB.NET in Visual Studio 2010 with 2012 Volume 1 (CLR 4.0). I have a button inside an UpdatePanel in an item template, but I cannot refer to it in the server code. The page source is:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="SimpleExample.aspx.vb" Inherits="DataPAEnterpriseWeb.SimpleExample" %> <%@ Register Assembly="Infragistics4.Web.v12.1, Version=12.1.20121.1005, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.Web.UI.NavigationControls" TagPrefix="ig" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <ig:WebExplorerBar ID="WebExplorerBar1" runat="server" Width="250px"> <Groups> <ig:ExplorerBarGroup GroupContentsHeight="" Text="Categories" Expanded="True"> <Items> <ig:ExplorerBarItem Text="Item" TemplateId="TreeViewTemplate"> <Template> <asp:UpdatePanel ID="TreeViewUpdatePanel" runat="server"> <ContentTemplate> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /> </ContentTemplate> </asp:UpdatePanel> </Template> </ig:ExplorerBarItem> </Items> </ig:ExplorerBarGroup> </Groups> <AutoPostBackFlags ItemClick="Off" /> </ig:WebExplorerBar> </div> </form> </body> </html>
However, The following:
Public Class SimpleExample Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Button1.Text = "OK" End Sub
End Class
Gives the following error "'Button1' is not declared. It may be inaccessible due to its protection level.".
Fantastic Michael, that worked. Thanks again for all your help, much appreciated.
Nick
Hi Nick,
After doing some testing with this, it seems that the issue actually lies in WebDataTree being in the UpdatePanel. First, I moved just the Tree outside of the ExplorerBar as you mentioned and it was working correctly. I then tried wrapping that Tree in the UpdatePanel and this reproduced the issue.
Our Aikido controls (WebDataTree, WebDataMenu, WebDataGrid, etc...) have AJAX functionality built into them. If you don't need the UpdatePanel around the Tree for other reasons, I recommend removing it. I've re-attached a sample that shows how I've set this up.
I'm still requesting to submit this as a development issue since I would expect this to work even when using an UpdatePanel.
Please let me know if you need further assistance with this.
Hi Michael,
Thanks for the help so far. I managed to get the event firing after working out the difference in my code (I had a ScriptManager rather than a WebScriptManager). Unfortunately I now have another problem!
In the event, I am changing the ContentURL of a WebSplitter panel. When the treeview was not inside the WebExplorer bar this worked fine, but now although I can see the event firing, IsPostBack is true and I can see the ContentURL being changed in my code, it never updates the content of the panel in the page.
I've replicated the problem in your example and attached it here. Thanks again for the help!!!
yeah sorry, been very busy the last week. Tried your project, and it works fine. Haven't had the chance to work out what's different, but will do next week. Will let you know how I get on, thanks for the help so far.
Please let me know how I can assist you further with this issue.