0

i am looking for a best jquery modal for use in asp.net with c# project in vs 2010...

so i found Simple Modal By Eric , But I Had some problems with it in ajax mode...

because that project works perfect in php & it seems does not support ajax in asp.net!

would u plz show us a nice modal jquery and learn us how can we keep it alive during postbacks ...

i want to use it as login page !

thanks for attention

best regards

SilverLight
  • 19,668
  • 65
  • 192
  • 300
  • [1](http://stackoverflow.com/questions/5611413), [2](http://stackoverflow.com/questions/5581275), [3](http://stackoverflow.com/questions/5567541), [4](http://stackoverflow.com/questions/5554289), [5](http://stackoverflow.com/questions/5491809); there will be many more if you look. – Majid Fouladpour May 14 '11 at 18:11
  • @LostLord: Yes that could be the case too, but if too many answers fall into that category, it is again a hint that you need to improve the readability of your questions ;) Good luck re-checking the answers; and meanwhile, your question here seem to have caught the attention of someone who knows his way with asp.net very well. From his tags, @chprpipr has answered 32 questions in that field. – Majid Fouladpour May 14 '11 at 21:27

2 Answers2

1

From the looks of things, you can make Simple Modal work using its most basic invocation. It sounds like you're using ASP.NET WebForms so you could do something like this:

MyPage.aspx

...
<asp:Button ID="btnPopupTrigger" runat="server" OnClick="OpenPopup" Text="Open Popup" />
...
<asp:Panel ID="pnlPopup" runat="server" CssClass="pnlPopup" Visible="false">
    <asp:TextBox ID="txtInput" runat="server" />
    ...
</asp:Panel>

<script type="text/javascript">

$("div.pnlPopup").modal();

</script>
...

MyPage.aspx.cs

...
protected void OpenPopup(object sender, EventArgs e)
{
    pnlPopup.Visible = true;
}
...

What this will do is hide the popup content until you want it to be shown. Once the asp:Panel is made visible, the jQuery will find it and make use of the SimpleModal plugin to make it display appropriately. This all requires that you're using standard postbacks, no asp:UpdatePanels or AJAX calls.

One issue you may run into is that it looks like this plugin grabs the modal content and appends it to the <body> element. ASP.NET expects to see those modal inputs within its <form>, so you might need to tweak the plugin to append the modal to <form> instead of <body>.

chprpipr
  • 2,039
  • 16
  • 17
  • dear @chprpipr:append the modal to
    was a good point in asp.net (default did n't let the inside buttons to postback - i was confused about this issue past days) ... my question in this thread solved by your Answer - but why update panel does not work inside modal area (for ur example -> inside the panel) / am i doing something wrong or this plugin have a formula about this issue ? -> plz answer to this question in this thread http://stackoverflow.com/questions/5851986/simple-modal-lost-in-postbacks-do-not-support-inside-ajax
    – SilverLight May 14 '11 at 23:02
  • Its a pretty complex explanation. This SO answer has a decent example: http://stackoverflow.com/questions/899761/how-to-control-which-javascript-gets-run-after-updatepanel-partial-postback-endre If you need to use an UpdatePanel, you might want to post a new question with some example code. – chprpipr May 14 '11 at 23:44
0

PHP and asp.net live on the server, what they both send to the browser is html, and it makes no difference what was used to generate that output. If something works with output generated with PHP, it should work with the same output generated by whatever other server-side script. This means, your problem (which you have not described) is not asp.net vs. PHP. soIn other words, if you switch to another modal plugin, it will not work either.

It is better to describe what problem you are having. Then, it would be possible to provide better help.

Majid Fouladpour
  • 29,356
  • 21
  • 76
  • 127
  • dear majid thanks for attention / at first i am doing my first job -> reading and studying my previous answers in past days / after doing that i will completely describe my problem in this thread – SilverLight May 14 '11 at 20:59