Monday, March 26, 2012

Modal Popup Extender Onokclick

Sorry for being such a newbie, but I have a Modal Popup

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Panel ID="Panel1" runat="server" Height="150px" Width="75%" CssClass="modalPopup">
<yada:UpdatePanel runat="server" ID="popup">
<ContentTemplate>
<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
<asp:TextBox ID="txtResponse" runat="server" Width="100%" Rows="25" TextMode="MultiLine"></asp:TextBox>
<asp:Button ID="btnSend" runat="server" Text="Send" OnCommand="btnSend_Click"/>
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</ContentTemplate>
</yada:UpdatePanel>
</asp:Panel>
<asp:Button ID="Button1" runat="server" Text="Button" />
<cc1:ModalPopupExtender ID="MPE" runat="server"
TargetControlID="Button1"
PopupControlID="Panel1"
DropShadow="true"
BackgroundCssClass="modalBackground"
OkControlID="btnSend"
CancelControlID="btnCancel"
/>

I want for the btnSend to cause a this code on the codebehind to execute. here is its code.

protected void btnSend_Click(object sender, EventArgs e)
{
Label1.Text = "Adfasdfasdf";
}

any suggestions to make this happen are greatly appreciated.

Place Label1 inside an updatepanel which has its updatemode property set to conditional and on the btnSend OnClick event do the following:

protected void btnSend_Click(object sender, EventArgs e)
{
Label1.Text ="Adfasdfasdf";
updatepanelwhereLabel1lives.Update();
}

German Afanador.


its still not getting into the function.

I actually want the the send onclick on the modal popup to send an email.


Instead of this:

<asp:Button ID="btnSend" runat="server" Text="Send" OnCommand="btnSend_Click"/>

Try this:

<asp:Button ID="btnSend" runat="server" Text="Send" OnClick="btnSend_Click"/>

German Afanador.


Hello,

You need to put the Label1 also in a updatePanel. (and set the Update condition to Always)

A control that is updated from a event, by a control inside a updatepanel, can never be outside a updatepanel, because that part of the page is not be refresht..

Marchu

No comments:

Post a Comment