Click here to Skip to main content
Rate this: bad
good
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)
   {
    pnlMonthly_Goals.Visible=true;
   }
 
<asp:Button ID="btnPost" runat="server" Text="Post" OnClick="btnPost_OnClick" />

<cc1:ModalPopupExtender runat="server" ID="mpc1"
BehaviorID="modalPopupExtender1"
TargetControlID="btnPost"
PopupControlID="pnlMonthly_Goals"
CancelControlID="btncancel"

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);"
onkeyup="javascript:TrackCount(txtPost,'pnlCC_tbCountdown',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
 
Thanks
Srinivas
Posted 21-Jan-13 14:33pm
srinvas685

1 solution

Rate this: bad
good
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:scriptmanager>
<asp:modalpopupextender cancelcontrolid="cancelLoginButton" id="loginModalPopuExtender" targetcontrolid="loginLinkButton" popupdraghandlecontrolid="PopupHeader" popupcontrolid="loginPanel" runat="server" xmlns:asp="#unknown">
</asp:modalpopupextender>
<asp:panel style="display:none;" runat="server" id="loginPanel" xmlns:asp="#unknown">
   <div>
      <div id="PopupHeader" class="modalPopup-header">Login</div>
         <table class="modalPopup-Content">
            <tr>
               <td style="width:50px;">
                  <asp:label id="Label1" runat="server" text="Email"></asp:label>
               </td>
               <td style="width:200px;">
                        <asp:textbox id="emailTextBox" style="width:200px;" runat="server"></asp:textbox>
               </td>
            </tr>
            <tr>
               <td>
                   <asp:label id="Label2" runat="server" text="Passwort"></asp:label>
                </td>
                <td>
                   <asp:textbox id="passwordTextBox" style="width:200px;" runat="server" textmode="Password"></asp:textbox>
                </td>
             </tr>
             <tr class="clear hideSkiplink">
                <td>
                   <asp:button id="cancelLoginButton" runat="server" text="Abbrechen" cssclass="modalPopup-button" />
                </td>
                <td style="text-align:right;">
                   <asp:button id="loginButton" runat="server" text="Login">
                            onclick="loginButton_Click" cssclass="modalPopup-button"/>
                </asp:button></td>
             </tr>
             <tr>
                 <td colspan="2">
                    <asp:label id="loginMessagesLabel" runat="server" text=""></asp:label>
                 </td>
             </tr>
         </table>
     </div>
</asp:panel>
 
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...
 

cheers,
Marco Alessandro Bertschi
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 Sergey Alexandrovich Kryukov 120
4 DamithSL 95
0 OriginalGriff 6,045
1 DamithSL 4,611
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,310


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 23 Jan 2013
Copyright © CodeProject, 1999-2014
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