I hope the title is clear.
What I wanted to achieve is that I have a global.cs that I use for public methods.
Problem is that it is not a CodeBehind for an ASPX page but just a code file. How to control the master page is the later issue. But before that I am able to show the Popup but the textbox that displays the message is not showing any data.
The below is the code of execution:
public void showModalPopup(string strMessage)
{
lblMessage.Text = strMessage;
mpeMessageMaster.Show();
}
Site.Master code snippet:
<ajaxToolkit:ModalPopupExtender ID="mpeMessageMaster" BehaviorID="mpeMessageMaster" runat="server" PopupControlID="pnlMessageMaster" BackgroundCssClass="modalBackground"
RepositionMode="RepositionOnWindowResizeAndScroll" TargetControlID="hfModalTarget" OkControlID="iCloseMessageMaster">
</ajaxToolkit:ModalPopupExtender>
<asp:Panel ID="pnlMessageMaster" runat="server" CssClass="modalPopup w3-panel w3-large" style="display:none;" >
<div>
<p style="float:left;"><asp:Label ID="lblMessage" runat="server" Text="" ForeColor="Black"></asp:Label></p>
<span class="w3-closebtn w3-display-topright"><i runat="server" id="iCloseMessageMaster" class="fa fa-window-close"></i></span>
</div>
</asp:Panel>
page1.aspx.cs
protected void showPopup(string strMessage)
{
Site siteMaster = Master as Site;
siteMaster.showModalPopup(strMessage);
}
Now page1.aspx.cs
has lot many methods, so I wanted to call a method in global.cs
(without creating object on every page) so that just global.cs
could create any required references and call showModalPopup
in Site.Master.cs
.
Since, I couldn't, I tried with code above and still cannot see the string that I pass in strMessage
.
Please guide.
Note: showPopup may be called from Async method call within UpdatePanel.