Hi there
I’m trying to activate the server-side ItemClick event of a WebExplorerBar control so I can log the selected menu options in a table but without too much success so far.
I’ve set the AutoPostBackFlags ItemClick property to ‘on’ and added the following proc to the vb code in the CodeBehind file:-
Protected Sub WebExplorerBar1_ItemClick(ByVal sender As Object, ByVal e As Infragistics.Web.UI.NavigationControls.ExplorerBarItemClickEventArgs) Handles WebExplorerBar1.ItemClick
Dim label1 As String Try label1 = e.Item.Value.ToString Catch ex As Exception label1 = ex.Message End TryEnd Sub
When you now click on one of the items in the WebExplorerBar it does the postback but it doesn’t ever execute the ItemClick procedure above (I've put a debug breakpoint in the procedure and it never gets there).
I'm sure I must have overlooked something really trivial here but I can't see what it is (I'm fairly new to ASP.NET and this control so apologies if the answer is obvious!).
Any help and guidance would be gratefully received - many thanks.
Hi,
this should be working with no problem. Just make sure you have autopostback flag for ItemSelected set to Off, because there is no guarantee which event is fired first. Also if this is OK, can you tell which version you are using?
Thanks,
Lubomir
Hi Lubomir
Many thanks for your reply. Yes, the autopostback flag for ItemSelected is set to off and the version of the control is 10.1.20101.1011.
In case it helps I'm using Visual Studio 2005 and this is the code:-
aspx file
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="SideMenu.aspx.vb" Inherits="CommandCentre.SideMenu" %>
<%@ Register Assembly="Infragistics2.Web.v10.1, Version=10.1.20101.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.Web.UI" TagPrefix="ig" %>
<%@ Register Assembly="Infragistics2.Web.v10.1, Version=10.1.20101.1011, 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 id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <ig:WebExplorerBar ID="WebExplorerBar1" runat="server" Width="128px" GroupExpandBehavior="SingleExpanded" StyleSetName="Default" Font-Size="Small"> <ExpandButton AltText="Expand button" /> <CollapseButton AltText="Collapse button" /> <AutoPostBackFlags ItemClick="On" /> </ig:WebExplorerBar> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <!-- dummy Link Button required to add postback method !--> <asp:LinkButton runat="server" id="lnk" style='display:none' Text='dummy' /> </form></body></html>
vb file
Imports Infragistics.Web.UI.NavigationControls
Partial Public Class SideMenu Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim MenuId As Integer Dim Section As Integer
Try 'Add the groups WebExplorerBar1.Groups.Add(New ExplorerBarGroup("Live")) ', "", "", "./images/BiggerPurpleExplorer.JPG")) WebExplorerBar1.Groups.Add(New ExplorerBarGroup("Reports")) WebExplorerBar1.Groups.Add(New ExplorerBarGroup("Vouchers")) WebExplorerBar1.Groups.Add(New ExplorerBarGroup("Payroll")) WebExplorerBar1.Groups.Add(New ExplorerBarGroup("Stock")) WebExplorerBar1.Groups.Add(New ExplorerBarGroup("Setup")) WebExplorerBar1.Groups.Add(New ExplorerBarGroup("Marketing")) WebExplorerBar1.Groups.Add(New ExplorerBarGroup("Resources")) WebExplorerBar1.Groups.Add(New ExplorerBarGroup("Pricing"))
For Each MenuId In CommandCentreInfo.UserList.GetUserById(Me.Session("LogonId")).UserMenus With CommandCentreInfo.MenuList.GetMenuById(MenuId) If .Enabled Then Dim Item As New Infragistics.Web.UI.NavigationControls.ExplorerBarItem Item.ImageUrl = "./images/dot.jpg" Item.NavigateUrl = .Process If .FullScreen And .Process <> "MainView.aspx" Then Item.Target = "_parent" Else Item.Target = "Main" End If Item.Text = .Description Item.ToolTip = .ToolTip Item.Value = .Id Section = IIf(.MenuSection = 0, 1, .MenuSection) WebExplorerBar1.Groups(Section - 1).Items.Add(Item) End If End With Next
Catch ex As Exception CommandCentre.Global.LogException(ex, "SideMenu.aspx", "Page_Load") End Try
Else
Session("ReportQuestion") = 0 Session("ToDate") = "" Session("FromDate") = "" Session("ReportId") = "" Session("GroupBy") = "" Session("Year") = "" Session("Month") = "" Me.Session.Remove("ReportFormularArray") Me.Session.Remove("ReportValueArray") Me.Session("salonid") = ""
End If
End Sub
End Class
Best regards and many thanks for your time
Hello,
thanks for the code. I have tested it and the ItemClick event handler is raised without any issues , but the arguments passed are empty and therefore you don't know which item is clicked. The good news is that this issue is resolved in the latest service release and you would be able to take advantage of the fix . All you need to do is to go to our website = > My IG =>Keys & Downloads, chose your product and download the latest service release and upgrade the toolset.
Hope this helps.
Hi Rado,
i have upgraded the infragistic version from 2011.1 to 2011.2,
i am using explorerbar with fallowing properties
<ig:WebExplorerBar ID="ActionItemPanel" runat="server" GroupExpandBehavior="SingleExpanded" Width="1024px" BorderStyle="None" EnableExpandButtons="False" EnableHotTracking="True" EnableSelection="true" AutoPostBackFlags-ItemClick="Off" AutoPostBackFlags-ItemSelected="Off" GroupExpandAction="ButtonClick" ItemIndent="2px" EnableViewState="False">
<Groups> <ig:ExplorerBarGroup Text="Actions" DisabledCssClass="igeb_QuickQubeItemDisabled"> <Items> <ig:ExplorerBarItem Text="Item" ImageUrl="~/Resources/Images/WebIcons/38contacts.ico" DisabledCssClass="igeb_QuickQubeItemDisabled" />
</Items> </ig:ExplorerBarGroup> </Groups> <ClientEvents ItemClick="FireClientEvent" /> </ig:WebExplorerBar>
at client side event FireClientEvent, i am firing a button click event.
page does postback but button clickevent does not come inside its own server click event.
why does this happen?
ClientCode
function FireClientEvent(){
document.getElementById('button1').click();
}
server side event of button1
protected void button1_click(object sender,eventArgs e){}
button at aspx form
<asp:Button ID="button1" Style="display: none;" OnClick="button1_click" runat="server" Text="click" />
Hello MyPost,
I've tested your code with:
and I confirm that the issue is resolved and the server-side event of the button is get fired.
Thanks for reply.