This is a migrated thread and some comments may be shown as answers.

DataBound menuitems with OnClientItemClicked for RadWindow pops radwindow into Target Pane and does not popup

4 Answers 44 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Neal
Top achievements
Rank 1
Neal asked on 14 Mar 2012, 02:45 PM

If I use DataBinding to create my menuitems, and use the OnClientItemClicked event to call a javascript which calls a radwindow (popup), the called radwindow does not popup, rather it loads into the target pane.
(well it pops up briefly, then exits and reloads in the Target Pane)

However, when I Create the MenuItems in HTML, the call to the OnClientItemClicked javascript , does popup the radwindow correctly.

My workaround for this was "AppendDataBoundItems" and retain a menu item from HTML, such that my popup radwindow pops up correctly...Happiness,..BUT

It is AppendDataBoundItems,...and I really want PrePend,..i.e. I would like my MenuItem with Popup to appear at the end of the Menu, not the beginning.

Any help,..ideas ? (for either).

Code is: 

RadMenu AdminAuthMenu = this.NavPane.FindControl("RadMenu1") as RadMenu;
AdminAuthMenu.DataSource = SiteMap.GetdbMenuItems();   //Just class with db sql to get MenuItems
AdminAuthMenu.DataBind();

protected void RadMenu1_OnItemDataBound(object sender, RadMenuEventArgs e)
{

    RadMenuItem ei = e.Item as RadMenuItem;

    ei.Target = "ContentPane";
}

Markup is:

 

telerik:RadMenu ID="RadMenu1"  runat="server" Width="100%" Height="31px" Skin="Black"

 OnClientItemClicked="MenuItemItemClicked"

 DataFieldID="ScreenId"

 DataNavigateUrlField="Screen"

 DataTextField="Title"

 DataValueField="ScreenId"

 OnItemDataBound="RadMenu1_OnItemDataBound"

 AppendDataBoundItems="True">

 <DefaultGroupSettings Flow="Horizontal" />

 <Items >
      <telerik:RadMenuItem runat="server" Text="Login" value="Login"

                  BackColor="Transparent" ForeColor="#FFFFC0"></telerik:RadMenuItem>

</Items>

 

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 19 Mar 2012, 10:27 AM
Hello Neal,

Could you please send us the entire code (including javascript) that is not working? We will try to replicate the problem locally and if we succeed, we will probably be able to suggest a specific workaround.

Kind regards, Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Neal
Top achievements
Rank 1
answered on 19 Mar 2012, 04:11 PM

ok thx, here it is

 

<body style="top:0; left:0 ; height:100%; overflow:hidden;" scroll="no">  

<form id="form1" runat="server" style="height:100%; margin:0px; width:100%;"> 

<telerik:RadScriptManager ID="Scriptmanager1" runat="server" AsyncPostBackTimeout="36000" EnableTheming="True">

 </telerik:RadScriptManager>

 

<script language="javascript" type="text/javascript">

  

window.onresize = window.onload = pageLoad;

 function pageLoad ()

 {

     var menu = $find("<%= RadMenu1.ClientID %>");

     var width = menu.get_element().offsetWidth;  

     var singleItemLength = Math.floor(width/menu.get_items().get_count())-1+"px";

 

    for (var i = 0; i < menu.get_items().get_count(); i ++)

    {

        var li = menu.get_items().getItem(i).get_element();

        li.style.width = singleItemLength;

     }

}

function OpenLogin()

{

    var urlExtn = "ms=" + new Date().getTime();

     var oWnd = radopen("LoginPg.aspx?" + urlExtn , "Login" );

    oWnd.moveTo( 240, 90 );

}

 

 

function MenuItemItemClicked(sender, args)

{

     var itemValue = args.get_item().get_value();

      if (itemValue == "Login")

      {

        OpenLogin();

      }

}

 

function ShowRadWinRegister()

{

    var urlExtn = "ms=" + new Date().getTime();

    var oWnd = radopen("/Forms/Registration.aspx?" + urlExtn , "Register" );

    oWnd.moveTo( 40, 50 );

}

</script>

 

<telerik:RadWindowManager

        ID= "RadWindowManager1" 

        runat= "server" Overlay="true" Modal="true" Skin="Black"
    <Windows>

        <telerik:RadWindow

            ID="Login"  runat="server" Width="520px" Height="150px" Top="130px" 
            Left
="180px"  Behaviors="None"   VisibleStatusbar="False" VisibleTitlebar="False" style="display:none;" 
            
Behavior="None" InitialBehavior="None" NavigateUrl="">

</telerik:RadWindow>

 

</Windows>

</telerik:RadWindowManager>

 

<asp:Panel runat="server" ID="MenuPanel" BackColor="Black" width="100%" ScrollBars="none">

 

<telerik:radsplitter id="RadSplitter1" runat="server" 
        Height ="800px" width="100%"  liveresize="true"

        orientation="Horizontal"  BorderColor="Transparent"

        ResizeWithParentPane="true"   ResizeMode="proportional"

        BorderStyle="None" style="position:relative; z-index:100">

 <telerik:radpane style="z-index:100"

         Height="40px" scrolling="None"  id="NavPane" runat="server"  width="100%" 
        BackColor
="Black"  MaxHeight="900"  MaxWidth="1270" >

 <div id="MenuDiv" align="center" class="MenuDiv"

            style="left: 0px; top: 47px; Height:100%; width:100%;z-index:998;">

 <telerik:RadMenu ID="RadMenu1" style="z-index:999; position:absolute;"

     EnableOverlay="true"

     runat="server" Width="100%"

     Skin="Black"

     OnClientItemClicked="MenuItemItemClicked"

     DataFieldID="ScreenId"

     DataFieldParentID="ParentScreenId"

     DataNavigateUrlField="Screen"

     DataTextField="Title"

     DataValueField="ScreenId"

     OnItemDataBound="RadMenu1_OnItemDataBound" >

     <Items >

         <telerik:RadMenuItem runat="server" Text="Login" value="Login"

                    BackColor="Transparent" ForeColor="#FFFFC0"></telerik:RadMenuItem>

 

    </Items>

 

</telerik:RadMenu>

</div>

 

</telerik:radpane>

<telerik:radpane id="RadPane2" runat="server"  height="100%"   width="100%"   scrolling="None" >

    <telerik:radsplitter id="RadSplitter2" runat="server"  orientation="Horizontal"  EnableEmbeddedSkins="false"  Height="100%" >

        <telerik:radpane id="ContentPane"

                 runat="server"  MinHeight="250"  ContentUrl="LandingPage.aspx"

 

                Width="100%"  MinWidth="600" MaxHeight="800" >

 

        </telerik:radpane>

 

    </telerik:radsplitter>

 

</telerik:radpane>

 

</telerik:radsplitter>

 

</asp:Panel >

 

<telerik:RadAjaxManager ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest"

            runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">

         <ajaxsettings>

             <telerik:AjaxSetting AjaxControlID="btnLogin">

                 <UpdatedControls>

                </UpdatedControls>

            </telerik:AjaxSetting>

        </ajaxsettings>

 </telerik:RadAjaxManager>

 <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">

 <asp:Image ID="Image1" ImageUrl="~/Images/LoadingProgressBar.gif"

         BorderWidth="0px" AlternateText="Loading" runat="server" Style="margin-top: 75px;">

 </asp:Image>

</telerik:RadAjaxLoadingPanel>

 

0
Peter
Telerik team
answered on 22 Mar 2012, 02:28 PM
Hello Neal,

I tested the code, but everything worked as expected. I assume the problem that you experience is caused by the fact that the Login item has its NavigateUrl specified, in which case, the item will navigate. You can conditionally reset the NavigateUrl for the login item like this:
protected void RadMenu1_OnItemDataBound(object sender, RadMenuEventArgs e)
  {
      if(e.Item.Value == "Login")
      {
          e.Item.NavigateUrl = String.Empty;
      }
       
  }

Attached is the sample I used for testing.

All the best,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Neal
Top achievements
Rank 1
answered on 02 Apr 2012, 08:45 AM
Thanks,
All sorted.
Neal
Tags
Menu
Asked by
Neal
Top achievements
Rank 1
Answers by
Peter
Telerik team
Neal
Top achievements
Rank 1
Share this question
or