Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
Web Explorer Bar and Button event issue
posted

I faced this issue with web explorer bar

Placing a button inside the template and issuing a post back action a format exception is thrown

It seems because the button control id is not included in the post back action the exception is thrown

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<

 

 

 

ig:webexplorerbar runat="server" width="268px" id="webexplorerBar"

 

 

 

Height="148px" onitemclick="webexplorerBar_ItemClick" EnableTheming=True

 

 

 

AnimationEquationType="Linear" BorderWidth="5px" MaxGroupHeight="30px">

 

 

 

<groups><ig:ExplorerBarGroup GroupContentsHeight="" Text="Test Group" Expanded=true ><Items><ig:ExplorerBarItem TemplateId="NewsTemp" ></ig:ExplorerBarItem></Items></ig:ExplorerBarGroup><ig:ExplorerBarGroup GroupContentsHeight="" Text="Test Group 3" Expanded ="true">

 

 

 

<Items><ig:ExplorerBarItem TemplateId="NewsTemp" Expanded="false" >

 

 

 

</ig:ExplorerBarItem></Items></ig:ExplorerBarGroup></groups><templates>

 

 

 

<ig:ItemTemplate ID="webexplorerBarTemplate1" runat="server" TemplateID

="NewsTemp"><Template><asp:Button ID="Button2" runat="server" Text="Button"></asp:Button>

 

 

 

</Template></ig:ItemTemplate></templates></ig:webexplorerbar>

I was able to overcome this behavior by letting the button call a javascript function instead of server code and then calling __doPostBack and passing the control id

function doButtonClickEvent(){if(Page_ClientValidate()) __doPostBack('mycontrol id', ''); }

and at my page page load event

if(IsPostBack){

 

 

string targetControl = Page.Request.Params.Get("__EVENTTARGET");

 

 

if (targetControl == "mycontrolid") myButton_OnClick();

}

 

  • 37874
    posted

    Hi Sameh,

    If you need any further assistance on the matter please do not hesitate to ask.

  • 37874
    posted

    Hi Sameh,

     

    I was reading through you post and the code you have provided seems to be correct. I am attaching a sample I created using version 11.2.20112.1019  where I add a button in the item template of WebExplorerBar. Clicking the button works as expected.

     

    Please let me know if you have any other questions.

    WebExpolrerBarItemTemplate.zip