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
502
Ultrawebmenu
posted

Hello

I'm having fun with the Ultrawebmenu.

Here is the code executed in the pageload of my control

 

      Dim SqlConn As New DBClass
        Dim dr As SqlDataReader = Nothing

        Dim ultraWebMenu As New UltraWebNavigator.UltraWebMenu
        ultraWebMenu.ID = "Menu" + _MenuType
        ultraWebMenu.WebMenuTarget = Infragistics.WebUI.UltraWebNavigator.WebMenuTarget.PopupMenu

        Dim txtbox As New WebDataInput.WebTextEdit
        txtbox.ID = "txtbox" + _MenuType
        txtbox.Attributes.Add("onclick", "ShowMenu('" + Me.ID + ultraWebMenu.ID + "');")

        Try
            SqlConn.ConnectDB()
            dr = SqlConn.Execute("SELECT * FROM popupmenus_pop WHERE pop_type ='" & _MenuType & "'")
            While dr.Read
                ultraWebMenu.Attributes.Add("onclick", "fillUpTxtBox('" + dr.Item("pop_name") + "', '" + txtbox.ClientID + "')")
                ultraWebMenu.Items.Add(dr.Item("pop_name"))

            End While
        Catch ex As Exception

        Finally
            If SqlConn.State = Data.ConnectionState.Open Then
                SqlConn.DisconnectDB()
            End If
            If Not dr Is Nothing Then
                dr.Close()
            End If
            Me.Controls.Add(txtbox)
            Me.Controls.Add(ultraWebMenu)
        End Try

 

 

But this line seems not to work

ultraWebMenu.Attributes.Add("ItemClick", "fillUpTxtBox('" + dr.Item("pop_name") + "', '" + txtbox.ClientID + "')")

 

I check the generated code and I can't find anywhere this function

Do you have an explanation or another way to do this ? 

 

Thx in advance 

Parents
  • 28464
    posted

    UltraWebMenu uses a flexible aproach when it comes to client-side events - a combination of client-side events + client-side object model - CSOM.

    You can use the MenuClientSideEvent property to customize the events you wish to handle. You can read about UltraWebMenu's CSOM in the documentation, but here is a sample approach:

     <MenuClientSideEvents
        ItemClick="ItemClick"
        SubMenuDisplay="SubMenuDisplay"
        ItemChecked="ItemChecked"
        InitializeMenu="InitializeMenu"
        ItemHover="ItemHover">
     </MenuClientSideEvents>

        <script language="javascript">

        function InitializeMenu(mn) {
            window.status = "Menu Initialized";
        }
        function ItemChecked(mn, id, bChecked) {
            var item = igmenu_getItemById(id);
            if(bChecked)
                alert(item.getText() + " is being checked on");
            else
                alert(item.getText() + " is being checked off");
        }
        function ItemClick(mn, id) {
            var item = igmenu_getItemById(id);
            var tag = item.getTag();
            if(tag != null)
                document.body.style.backgroundColor = tag;
            return false;
        }
        function ItemHover(mn, id, bOver) {
            var item = igmenu_getItemById(id);
            if(bOver)
                window.status = item.getText();
            else
                window.status = "";
            return false;
        }
        function SubMenuDisplay(mn, id, bShow) {
            if(bShow && (id == "UltraWebMenu1_1M" || id == "UltraWebMenu1_2M"))
                igmenu_getElementById("DropDownList1").style.visibility = "hidden";
            else
            if(!bShow && (id == "UltraWebMenu1_1M" || id == "UltraWebMenu1_2M"))
                igmenu_getElementById("DropDownList1").style.visibility = "visible";
            return false;
        }   


            </script>

Reply Children
No Data