asp.net 4.0获取usercontrol值并将值传递给aspx页面 [英] asp.net 4.0Get a usercontrol value and pass a value to aspx page

查看:72
本文介绍了asp.net 4.0获取usercontrol值并将值传递给aspx页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在usercontrol中有一个下拉列表,在aspx页面中有一个下拉列表,当我选择一个usercontrol下拉列表索引意味着aspx页面下拉列表将绑定数据库中的值.....如何做到这一点帮助我

i have a one dropdownlist in usercontrol and one dropdownlist in aspx page when i select a usercontrol dropdownlist index means aspx page dropdownlist will be bind the values from database .....how to do this help me

推荐答案

您好,



在用户控件下拉列表的选定索引更改事件中,添加以下代码。

Hi,

On the selected Index change event of the dropdown in user control, add below code.
DropDownList ddlParent = (DropDownList)this.Parent.FindControl("dropdownlist1");
// dropdownlist1 ID of parent dropdownlist
if(ddlParent != null)
{
  //bind the dropdown list
}





hope它有帮助。



hope it helps.


这篇关于asp.net 4.0获取usercontrol值并将值传递给aspx页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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