Last post Nov 28, 2012 11:47 AM by ferrymeidianto
Nov 07, 2012 03:58 PM|vermaanubhav1|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 01:54 AM|Angie xu - MSFT|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 06:30 PM|vermaanubhav1|LINK
What is the process of do so? Can you share any example code for the same.
Nov 23, 2012 06:33 PM|vermaanubhav1|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 03:49 AM|Angie xu - MSFT|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 04:01 AM|ferrymeidianto|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 11:16 AM|vermaanubhav1|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 11:47 AM|ferrymeidianto|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).