Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 28, 2012 03:47 PM by ferrymeidianto
Nov 07, 2012 07:58 PM|LINK
Hi I want to popup a modal popup extender from class file. For example display popup at page abcd.aspx when it will check some condition in the class file xyz.cs and if condition satisfies popups a modalpopup from there only...
Nov 14, 2012 05:54 AM|LINK
it will check some condition in the class file xyz.cs and if condition satisfies popups a modalpopup from there only...
You could put modalpopup in class file, if the class file is called by event, and modalpopup will be triggered.
But the modalpopup won’t be triggered automatically by itself.
hope it helps you.
Nov 23, 2012 10:30 PM|LINK
What is the process of do so? Can you share any example code for the same.
Nov 23, 2012 10:33 PM|LINK
My requirement is that I am having a class file which checks for user session. If the user session is not there then I want to popup a model popup with login screen irrespective of the page user is. So a common modal popup which can popup on any page wherever
the user is if session is not there.
Nov 28, 2012 07:49 AM|LINK
You can search lots of information available online about this,
Moreover this is also available about session
If you encounter any problem, please let me know.
Nov 28, 2012 08:01 AM|LINK
You can use Show() method of the ModalPopup.
There is a thread already about showing ModalPopup from codebehind
In you case, don't call the ModalPopup from that xyz.cs file, but call it from code-behind of abcd.aspx (abcd.aspx.cs)
Let's say you have a static method in xyz.cs with name of "CheckUserSession", then from abcd.aspx.cs call it like this:
if (xyz.CheckUserSession() == false)
Hope this helps.
Nov 28, 2012 03:16 PM|LINK
You didnt got what the problem is. Problem is that i am having a common.cs file its just a class file. Over there i am checking That if session is present or not(or user is logged in or not). Now the problem is
if(usernot logged in)
now how this modal popup will be shown. Irrespective of page I am. Where I am going todeclare the control or if programaticallly create control like.
Panel p1 = new Panel();
HtmlInputButton h1 = new HtmlInputButton();
Label l1 = new Label();
l1.Text = s;
AjaxControlToolkit.ModalPopupExtender mpe = new AjaxControlToolkit.ModalPopupExtender();
mpe.PopupControlID = p1.ID;
mpe.BackgroundCssClass = "modalBackground";
mpe.TargetControlID = h1.ID;
but i am not able to show it. Once again This code will be from class file not aspx.cs page.
Nov 28, 2012 03:47 PM|LINK
You need to add that ModalPopupExtender to the page first of course. Add it to any container object just like you add h1 and l1 to p1 (panel).