0

After being exhausted with various post back and other issues related to modal popup ( ajax/jquery/javascript) we came up with a simple trick that seems to be working fine so far. We are to implement this in hundreds of other aspx files and we are afraid that this solution might come up with a issue in future so far not known to us. If some one can point out the potential issues we would really appreciate that.

On button click this is the code that fires up a pseudo popup: See this popup in action http://02e34b5.netsolhost.com/youtube/Zpopup.aspx

<asp:Panel ID="pseudopopup" runat="server" visible="false">
 <table style="position: fixed; z-index: 1; left: 0px; top: 0px"   border="0"  width="100%" height="100%">

// position fixed is essential. div wont extend 100% in height but an html table would
// no background color hence everything behind tbl is visible but NOT clickable 

    <tr>
        <td valign="top"  align="center" >

// this would put a nice center aligned div with css shadow helping give it a popup shape

        <div style=" width: 1000px;  margin-top:80px; padding:10px;  background-color: #FF00FF" id="layer2" class="roundshadow">
        Grid goes here
                 Form view goes here
                other stuff goes here
                no need to worry about the postback

             close button goes here that makes the panel visible = false

 </div>
        </td>

    </tr>
    </table>
   </asp:Panel>

This has been so far working with out any issues. See this popup in action http://02e34b5.netsolhost.com/youtube/Zpopup.aspx

Shankar
  • 125
  • 2
  • 12

1 Answers1

1

It will work of course, but with some ifs. As a pure server-side method, this has all the cons and pros of such an approach.

pros:

  • Easier to implementation. No worries about the client scripts.
  • Anything you need is available on the server-side. You won't need to make additional requests to acquire data from the server.
  • Has no script compatibility issues, works on any browser.
  • No need to learn Javascript. The server-side language (c#, VB) will be enough
  • No need to learn HTML DOM or any additional client-side frameworks. Just asp.net

cons:

  • Postbacks are expensive and consume a lot of resources on the server. This will become a serious problem when the number of concurrent requests grow. You will have to employ a resourceful web server (better CPU, more RAM, more powerful Network connection, ...)
  • This is slower than a client-side popup window because of the round-trip to the server.
  • The user can't "play" with this dialog. Actions like moving, resizing, keeping fixed, ... are practically impossible.
  • As the page grows, you will face the problem of ViewState which makes the pages huge.
  • This is an out-of-date solution. Nobody likes it anymore and people (users and coworkers) will begin to shout at you for implementing something like this.
  • If the server needs any data from the client-side (window size, ....), you should send them along with your request.

Conclusion:

  • Use this approach only if you have an Intranet site with low traffic and few users.
  • Never use it for a real-world Internet web site.
Alireza
  • 4,976
  • 1
  • 23
  • 36
  • I apologize but I would disagree with 99% of your comments. We have deployed this on a community website that attracts more than million hits a month. So far no issues at all. Other methods using ajax / css/ javascript / jquery - all ended in one or other nightmares. – Shankar Aug 09 '14 at 22:27
  • Then why did you ask the question in the first place? If you have no problem with this approach, I will have none :) – Alireza Aug 09 '14 at 22:29
  • because we have to replicate this code in hundreds of other apsx pages. And a coding guru would have the insight to see the repercussions, if any, that we are unable to see. :) . – Shankar Aug 09 '14 at 22:36
  • 1
    I won't dare calling myself a guru, but I have a 10 year experience on web applications and I'm telling you that client-side pop-ups are way better than server-side ones. And of course I won't argue with you on the matter. This question is on the edge of being `opinion-based` – Alireza Aug 09 '14 at 23:09
  • Based on your experience I would have not hesitation in calling you a guru. You are. However, I feel your hands on engagement with ajax / jquery popup on an aspx page are not enough to understand the postback issues. I am sure you might be busy with far more complex things on the backend side. I have slightly tweaked the code to create a presentation layer that bypasses the the need for ajax / jquery etc. Folks who are frustrated with modal popup will immediately see what I am trying to convey here. – Shankar Aug 09 '14 at 23:45
  • As I said, I won't argue. And I hope you won't face any problems with this method. Good luck :) – Alireza Aug 10 '14 at 13:28