Click here to Skip to main content
11,576,293 members (61,971 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET Ajax
hi have an application if i click post button it shows pop up extender with

textbox and buttons.

it shows popup extender only after i click the post button second time. why?first time it is not showing pop up.
below is the code.

protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)
pnlMonthly_Goals.Visible = false;

protected void btnPost_OnClick(object sender, EventArgs e)

<asp:Button ID="btnPost" runat="server" Text="Post" OnClick="btnPost_OnClick" />

<cc1:ModalPopupExtender runat="server" ID="mpc1"

BackgroundCssClass="modalBackground" >

<asp:Panel ID="pnlMonthly_Goals" runat="server" >
<asp:UpdatePanel ID="upanel1" runat="server">

<asp:TextBox ID="txtPost" TextMode="MultiLine" runat="server" onkeypress="javascript:LimitText(txtPost,500);"
Height="140px" Width="700px">

<%--<cc1:TextBoxWatermarkExtender ID="txboxwatmrk_post" TargetControlID="txtPost" WatermarkCssClass="watermark" WatermarkText="Write a post...!!" runat="server">--%>
<asp:RequiredFieldValidator ID="reqtxtPost" ValidationGroup="vgroup" runat="server" ControlToValidate="txtPost" ErrorMessage="Please enter a post" BackColor="#F0F8FF">
<input type="text"
id="pnlCC_tbCountdown" value="" name="pnlCC_tbCountdown" style="border:0px;padding-bottom:10px;color:Red;background-color:#F0F8FF;"
readonly="readonly" />

<asp:FileUpload ID="fp1" runat="server" />
<asp:RegularExpressionValidator ID="FileUpLoadValidator1" runat="server" ErrorMessage="Attach Only doc,docx,pdf,xls,xlsx files!" ValidationExpression=".*(.doc|.docx|.pdf|.xls|.xlsx)$" ControlToValidate="fp1" Display="Dynamic">

<asp:FileUpload ID="fp2" runat="server" />
<asp:RegularExpressionValidator ID="FileUpLoadValidator2" runat="server" ErrorMessage="Attach Only doc,docx,pdf,xls,xlsx files!" ValidationExpression=".*(.doc|.docx|.pdf|.xls|.xlsx)$" ControlToValidate="fp2" Display="Dynamic">

<asp:ImageButton ID="btnShare" ImageUrl="Images/share.jpg" CssClass="sharebutton" ValidationGroup="vgroup" OnClick="btnShare_Click" runat="server"/> <asp:ImageButton ID="btncancel" ImageUrl="~/Saibook/Images/CancelButtonUp1.gif" CssClass="sharebutton" runat="server" CausesValidation="false"/>

<%--<asp:ImageButton ID="ImageButton2" ImageUrl="Images/share.jpg" CssClass="sharebutton" OnClick="btnShare2_Click" OnClientClick = "Confirm()" runat="server" />--%>

please reply

Posted 21-Jan-13 13:33pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

ModalPopupExtender has to use a panel to display as the modal popup frame.
This code:
<asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown">
<asp:modalpopupextender cancelcontrolid="cancelLoginButton" id="loginModalPopuExtender" targetcontrolid="loginLinkButton" popupdraghandlecontrolid="PopupHeader" popupcontrolid="loginPanel" runat="server" xmlns:asp="#unknown">
<asp:panel style="display:none;" runat="server" id="loginPanel" xmlns:asp="#unknown">
      <div id="PopupHeader" class="modalPopup-header">Login</div>
         <table class="modalPopup-Content">
               <td style="width:50px;">
                  <asp:label id="Label1" runat="server" text="Email"></asp:label>
               <td style="width:200px;">
                        <asp:textbox id="emailTextBox" style="width:200px;" runat="server"></asp:textbox>
                   <asp:label id="Label2" runat="server" text="Passwort"></asp:label>
                   <asp:textbox id="passwordTextBox" style="width:200px;" runat="server" textmode="Password"></asp:textbox>
             <tr class="clear hideSkiplink">
                   <asp:button id="cancelLoginButton" runat="server" text="Abbrechen" cssclass="modalPopup-button" />
                <td style="text-align:right;">
                   <asp:button id="loginButton" runat="server" text="Login">
                            onclick="loginButton_Click" cssclass="modalPopup-button"/>
                 <td colspan="2">
                    <asp:label id="loginMessagesLabel" runat="server" text=""></asp:label>

Looks like this on My Page[^]. To expand the popup, click on "Login" in the top right corner.
Feel free to view the page source, it might help you a bit...

Marco Alessandro Bertschi

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 285
1 F-ES Sitecore 140
2 Abhinav S 115
3 Lucifier Rocks 105
4 OriginalGriff 105
0 OriginalGriff 705
1 Sergey Alexandrovich Kryukov 630
2 Abhinav S 438
3 F-ES Sitecore 410
4 Suvendu Shekhar Giri 365

Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | Last Updated 23 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100