0

マスター ページのラベルをコンテンツ ページから変更して、確認メモを表示したいと考えています。

エラーは発生しません。すべての値はデバッグで期待どおりですが、画面上のテキストは変更されません。私は数多くの例を見て、いくつかの方法を試しましたが、望ましい効果が得られないようです。何か案は?

aspx:

<%@ MasterType VirtualPath="~/SLA.Master" %>

マスター ページ - SLA.Master.cs:

{
    public partial class SLA : System.Web.UI.MasterPage
    {

        public void SetMyMessage(string MyMessage)
        {
            MyMessageDisplay.Text = MyMessage;
        }

コンテンツ ページ - SLAEdit.aspx.cs:

    protected void FormView1_ItemDeleted(Object sender, FormViewDeletedEventArgs e)
    {
        if (e.Exception == null)
        {

            Master.SetMyMessage("Service Deleted");
4

3 に答える 3

0

これがうまくいくことを願っています:

protected void Page_Load(object sender, EventArgs e)
{
    Label lbl_TitlePage = Page.Master.FindControl("lbl_TitlePage") as Label;
    lbl_TitlePage.Text = "THE KEY QUESTIONS";
}
于 2014-07-07T09:47:10.480 に答える
0

これを試して:

(Master.FindControl("MyMessageDisplay") as TextBox).Text = "Service Deleted";
于 2013-06-24T20:58:05.273 に答える
0

これを試して:

(Master as SLA).SetMyMessage("Service Deleted");
于 2013-06-24T20:49:29.863 に答える