如何在PageLoad上的Serverside中为控件嵌套母版页获取值 [英] How to Get Value in Serverside on PageLoad for a control Nested Master Page

查看:77
本文介绍了如何在PageLoad上的Serverside中为控件嵌套母版页获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个嵌套的Master Page.First Master和Main Master,这个下拉列表在First Master上,我需要在服务器事件的页面值中从DataBase parent.document.getElementById('MDDL_Dept')获取数据。值





谢谢,

I had a Nested Master Page.First Master and Main Master and this dropdown is on First Master i need its value in page for server event for fetching data from DataBase parent.document.getElementById('MDDL_Dept').value


Thanks,

推荐答案

尝试在文档中证明两个masterpages contentplace holder id .getelemntbyid

ie document.getElementById

('Contentplaceholderidofmainmaster_contentplaceholderidoffirstmaster_MDDL_Dept')。value
try proving both masterpages contentplace holder ids in socument.getelemntbyid
i.e document.getElementById
('Contentplaceholderidofmainmaster_contentplaceholderidoffirstmaster_MDDL_Dept').value


获取母版页控制我们需要得到首先控制然后使用它



to get master page control we need to get the control first and then used it

var dropdown=(DropDownList)Master.FindControl("MDDL_Dept");
            if (dropdown != null)
            {
                //you code
                string yourvalue = dropdown.SelectedValue;
            }


这篇关于如何在PageLoad上的Serverside中为控件嵌套母版页获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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