Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to show ModalPopUpExtender in Page Load?

I'm Using Asp.net with C# as code behind. I want to show a terms & conditions pop up after login (redirected to next page and its page load)
Posted

We can write a function in Java script as


C#
function PageLoad()
        {
            document.getElementById("btn").click();
        }



and call it in Page Load as

<body onload="PageLoad()" >

and place a button control in page.

& for ModalPopUp,

VB
<ajaxToolkit:ModalPopupExtender ID="ModalPopUp" runat="server" BackgroundCssClass="modalBackground"
                cancelcontrolid="CancelButton" dropshadow="true" okcontrolid="OkButton"
            popupcontrolid="Panel1"  targetcontrolid="btn">


btn is ID of button control.


It will work.
 
Share this answer
 
Try this in your Page_Load Event.
C#
ModalPopUpExtender1.Show();


--Amit
 
Share this answer
 
Comments
KuttiSankar 18-Jun-13 6:36am    
No im asking how to call it in page load event? wat will be target control id?

<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" >


This is my code and what i can put target control id for triggering the pop up in page load event?
_Amy 18-Jun-13 6:39am    
Panel will be the best option. You can use a panel to do the same.
KuttiSankar 18-Jun-13 6:42am    
Yes i have panel also but i want to know how to trigger it while page load?
_Amy 18-Jun-13 6:44am    
Try this in your Page_Load:
ModalPopUpExtender1.TargetControlID = YourPanelID.ClientID;
ModalPopUpExtender1.Show();
--Amit
KuttiSankar 18-Jun-13 6:47am    
Error:
Object reference not set to an instance of an object.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900