If you had lengthier menus in you ASP.Net application and had used report viewer control you may have faced the problem of report and menu overlapping when ever the report is loaded with data. For example in my sample application it appeared as below.
To correct this behavior you need to set the z-index for menu and report viewer using CSS class property. For this I have used the following CSS classes in the Style.CSS.
- /* CSS Class for the Menu. */
- div.menu
- {
- padding: 4px 0px 4px 8px;
- }
- /* CSS Class for a Menu Item. */
- div.menu ul
- {
- list-style: none;
- margin: 0px;
- padding: 0px;
- width: auto;
- z-index: 1; /* Setting the control to appear on top of level 0 controls for e.g. report viewer. */
- }
- /* CSS Class for the Report Viewer. */
- .report
- {
- z-index: 0; /* Setting the control to appear below the level 1 controls for e.g. menu items. */
- }
To apply the CSS use a code similar to following.
Appling CSS Class to menu in master page.
- <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu"
- EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
- <Items>
- <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
- <asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>
- <asp:MenuItem Text="New Item" Value="New Item">
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- </asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item">
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- </asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- <asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
- </Items>
- </asp:Menu>
Appling CSS Class to report viewer.
- <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" CssClass="report"
- Font-Size="8pt" InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana"
- WaitMessageFont-Size="14pt" Width="636px">
- <LocalReport ReportPath="Report1.rdlc">
- <DataSources>
- <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
- </DataSources>
- </LocalReport>
- </rsweb:ReportViewer>
This will correct the overlapping issue as seen below.
It si not working fine for me.I followed exactly the same steps you have mentioned.I am using asp.net 4.0.
Could you please tell me if anything I am missing
Hi Brundaban,
Sorry for the late reply, make sure you did apply the correct style with different z index orders to your menu and report viewer.
Always make sure the z index of the menu is larger than the report viewer.
Aother thing which comes up to my mind is sometimes your report viewer might be in another container like a panel. In that case try setting the z index in the container as well.
Let me know how it goes.
Regards,
Arjuna.
Hi Arjuna,
For me the issue happens, when deployed in server, in local machine there is no issues. I have tried all the fix, but no hope.
Please provide your suggestions.
Thanks,
Fouzan
Hi Fouzan,
After deploying did you try from the server or is this happenning when you access the site from a local machine?
Also what are the browsers you tried? Is it happenning in all browsers?
Arjuna.
Hi Arjuna,
Thanks a lot for your reply…. The issue got fixed, as I removed position:relative in css… I was using the default stylesheet came with asp.net 4.0 default website….
Thanks Again
Fouzan.
God Bless you my Dear 🙂
Thank u
Perfect man!
Thak you ,it saved me bunch of research time.