mandag den 7. januar 2013

Modal detailsview

Simple tip, this,

if you're displaying an DetailsView on your aspx-page, you'll perhaps consider showing it with a modal-background so as to bring focus on it.

This is easily implemented by showing a hitherto hidden panel on the page. Here's the mark-up for that - put it at the very top of the page:


Then, in the code-behind code which shows the DetailsView, you'll include a bit of javascript (using Jquery here, but you don't have to) to show the hidden div:

detailsPanel.Visible = true;

System.Text.StringBuilder sbScript = new System.Text.StringBuilder("");


ScriptManager.RegisterStartupScript(this, this.GetType(), "@@@@MyPopUpScrip1t", sbScript.ToString(), false);

The only thing you'll need to remember to do is to add css to your DetailsView, to position it and add a z-index higher than the modalBackground, so it'll be presented above the gray full-screen background. So add this as the css-class attribute value for your DetailsView:

.zindexedDetailsview {
z-index: 100;
position: relative;

That's all there is to it. All other solutions I've seen include the Ajax framework and specifically the use of the ModalPopupExtender, so here's a lighter weighted alterantive.

Works for me with VS2012, .net 4.5, Jquery 1.8.3. Cheers!

1 kommentar:

  1. Get in touch with the real estate agent. We at PROPERTY HUNTER shifted this service to a level much higher than the broker concept. Our highly trained and professional experts team will review and evaluate our client's needs and requirements.

    There are numerous factors affect the real estate market demand and supply, Interest rates, economic growth, de-mographics, mortgage availability and consumer confidence. For investors who have hold their properties for numerous years now can be a good time to sell and take advantage of new opportunities with aggressive payment plans whom has a great growth and return potential. We as expert in the local market will share with you the status of the real estate market and provide the proper advice to achieve your target. We have wide varieties of options of off plan projects and ready residential and commercial properties. Ranging from Apartments; studios, penthouses, townhouses, lands, plots, villas, office spaces, showrooms, hotel apartments and suits, commercial buildings, residential buildings, VIP tow-ers and hotel projects. you can see more details like this article Property for sale Properties For Sale in Qatar