Tuesday, 24 June 2014

how to display child menuitem of asp:menu in asp.net





Description:-
I          
            In this example we explain that how to display childmenu item in all browser.
There are many question in your mind that

asp:menu does not display Child Menu items in IE 8

Does not show dynamic submenus of the Menu control in asp.net

Menu Control showing only Root Items, but no child items


That is the live problem that I have faced in my application that is in my application if we run our application in Internet Expoler 7 then submenu or Childmenu  will be displayed but  In other browser like mozila firefox and google chrome browser doesnot support this thing, so behind this reason we have to convert code in browser comp ability code so it will worked in all browser. So to do this you have to follow the following step like

à Create App_Browser Folder in Your Project.
à Right click on folder and add new item ‘Browser File’ and add it in your project.
à paste the following code in Browser File.



<!--
    You can find existing browser definitions at
    <windir>\Microsoft.NET\Framework\<ver>\CONFIG\Browsers
-->
<browsers>
    <browser id="NewBrowser" parentID="Mozilla">
        <identification>
            <userAgent match="Unique User Agent Regular Expression" />
        </identification>

        <capture>
            <userAgent match="NewBrowser (?'version'\d+\.\d+)" />
        </capture>

        <capabilities>
            <capability name="browser" value="My New Browser" />
            <capability name="version" value="${version}" />
        </capabilities>
    </browser>

    <browser refID="Mozilla">
        <capabilities>
            <capability name="xml" value="true" />
        </capabilities>
    </browser>

  <browser refID="safari1plus">
    <controlAdapters>
      <adapter controlType="System.Web.UI.WebControls.Menu" adapterType="" />
    </controlAdapters>
  </browser>
 
</browsers>



0 comments:

Post a Comment