Skip to content
April 1, 2008 / kiranpatils

How to use ShowModalDialog With ASP.NET

Today i need to show menu on click of ASP.NET Menu…when i click any menuitem it should show a Dialog window and code for it[javascript:showmodal…] is coming from database…

how can i do that????googled it…then also no luck….then finally..explored MenuItem class from MSDN and got it…so here it is…

I had <asp:Menu> which looks like:
<asp:Menu ID=”ContextMenu” runat=”server”  Orientation=”Vertical”
StaticSubMenuIndent=”10px” DynamicHorizontalOffset=”2″ Width=”150px”  DynamicVerticalOffset=”2″ StaticEnableDefaultPopOutImage=”False”
ForeColor=”White” Font-Bold=”True”  CssClass=”MyMenu”>
<StaticMenuItemStyle HorizontalPadding=”5px” VerticalPadding=”2px” />
<DynamicHoverStyle CssClass=”DynamicHoverStyle” ForeColor=”White” />
<DynamicMenuStyle CssClass=”DynamicHoverStyle”/>
<StaticSelectedStyle CssClass=”DynamicHoverStyle”/>
<DynamicSelectedStyle CssClass=”DynamicHoverStyle” />
<DynamicMenuItemStyle HorizontalPadding=”5px” VerticalPadding=”2px” />
<StaticHoverStyle  CssClass=”DynamicHoverStyle” ForeColor=”White” />

and Page_Load i am binding it with my data which is coming by one function and that function calls database…

ContextMenu[] contextmenu = MenuHelper.GetContextMenu(1);
MenuItem _menuitem = null;
foreach (ContextMenu item in contextmenu)
_menuitem = new MenuItem(item.menuTextField,item.urlField,string.Empty,item.urlField);

That’s it..

on click of my menu it opend ModalWindow..using ShowModalDialog.

Reference:: Pls alloccate some time and read this:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: