如何使用c#禁用内容页面中的母版页面asp控件 [英] how to disable master page asp controls in content page using c#

查看:107
本文介绍了如何使用c#禁用内容页面中的母版页面asp控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了不同的代码,但它们没有用,请建议我如何使用c#

i have tried different codes but they haven't work please suggest me how can i do it using c#

推荐答案

,例如我有主框架的TextBox id是am1,我想禁用它,所以在你的cs页面中将代码写成bwelow的内容形式。



for example i have TextBox in master form which id is am1 and i want to disabled it so write code in your cs page as bwelow in content form.

TextBox txt = (TextBox)Master.FindControl("am1");
                txt.Enabled = false;


// Gets a reference to a Label control that not in a ContentPlaceHolder
    Label mpLabel = (Label) Master.FindControl("masterPageLabel");
    if(mpLabel != null)
    {
        Label1.Text = "Master page label = " + mpLabel.Text;
      Label1.Enable=false
    }


从阅读本文开始: http://msdn.microsoft.com/en-us/library/xxwa0ff0.aspx [ ^ ]
Start with reading this: http://msdn.microsoft.com/en-us/library/xxwa0ff0.aspx[^]


这篇关于如何使用c#禁用内容页面中的母版页面asp控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆