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...
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.
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)
{
Modalpopup.show()
}
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; p1.Controls.Add(h1); p1.Controls.Add(l1); AjaxControlToolkit.ModalPopupExtender mpe = new AjaxControlToolkit.ModalPopupExtender(); mpe.PopupControlID = p1.ID; mpe.BackgroundCssClass = "modalBackground"; mpe.TargetControlID = h1.ID; mpe.Show();
but i am not able to show it. Once again This code will be from class file not aspx.cs page.
vermaanubhav...
Member
3 Points
39 Posts
Modal popup extender popup from class file
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...
Thanks.
Angie xu - M...
All-Star
18602 Points
1575 Posts
Microsoft
Re: Modal popup extender popup from class file
Nov 14, 2012 05:54 AM|LINK
Hi
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.
Regards
Feedback to us
Develop and promote your apps in Windows Store
vermaanubhav...
Member
3 Points
39 Posts
Re: Modal popup extender popup from class file
Nov 23, 2012 10:30 PM|LINK
What is the process of do so? Can you share any example code for the same.
vermaanubhav...
Member
3 Points
39 Posts
Re: Modal popup extender popup from class file
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.
Angie xu - M...
All-Star
18602 Points
1575 Posts
Microsoft
Re: Modal popup extender popup from class file
Nov 28, 2012 07:49 AM|LINK
Hi vermaanubhav
You can search lots of information available online about this,
Moreover this is also available about session here.
If you encounter any problem, please let me know.
hope it helps you.
Kind regards
Feedback to us
Develop and promote your apps in Windows Store
ferrymeidian...
Member
500 Points
126 Posts
Re: Modal popup extender popup from class file
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
http://forums.asp.net/t/1360105.aspx/1
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) { ModalPopup.Show(); }Hope this helps.
Regards,
Ferry Meidianto
www.meidianto.com
vermaanubhav...
Member
3 Points
39 Posts
Re: Modal popup extender popup from class file
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)
{
Modalpopup.show()
}
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;
p1.Controls.Add(h1);
p1.Controls.Add(l1);
AjaxControlToolkit.ModalPopupExtender mpe = new AjaxControlToolkit.ModalPopupExtender();
mpe.PopupControlID = p1.ID;
mpe.BackgroundCssClass = "modalBackground";
mpe.TargetControlID = h1.ID;
mpe.Show();
but i am not able to show it. Once again This code will be from class file not aspx.cs page.
ferrymeidian...
Member
500 Points
126 Posts
Re: Modal popup extender popup from class file
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).
Regards,
Ferry Meidianto
www.meidianto.com