在onclick事件上生成动态下拉列表 [英] generate Dynamic Dropdown list on onclick event

查看:75
本文介绍了在onclick事件上生成动态下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生/妈妈,
我想在锚标签的onclick事件上生成动态下拉列表..此标签位于Gridview中...请帮助我..im在开发字段中...锚标签的onclick我要显示下拉列表....




提前thnx..

sir/mam,
i wanna generate dynamic dropdownlist on onclick event of anchor tags..this tags is inside the Gridview...pls help me out..i m in development field...onclick of anchor tags i want to show the dropdownlist....




thnx in advance..

推荐答案



为什么只使用锚标记?相反,您可以使用链接按钮

下拉列表在哪里?在gridview中或不在gridview中.

当您提出问题时,请更具体.

假设下拉列表与锚点或链接按钮位于同一单元格中.

转到设计模式,然后单击gridview的编辑项目模板,然后导航到linkbutton单元格.轻按一下即可生成链接按钮的点击事件.
在click事件中,获取行,然后获取下拉列表并设置其可见性.

linkbutton_Click(......)
{
LinkBut​​ton lnb =(LinkBut​​ton)发送器;
TableRow tRow =(TableRow)lnb.Parent.Parent;
DropdownList ddl =(DropdownList)tRow.FindControl(yourdropdown ID);
ddl.visible = true;
//在此处编写代码以绑定dropdwon列表

}


希望这会有所帮助.

但是,当您要问一个问题时,请自行尝试一些问题,如果您无法解决该问题,请问一个问题,否则您将一无所获.

快乐编码.

问候
斯里曼
Hi,

Why you are using anchor tag only ? Instead you can use link button

Where is the dropdownlist ? in gridview or out of gridview.

When you are asking a question please be more specific.

Assuming dropdownlist is in the same cell as your anchor or linkbutton exists.

Go to design mode and click edit item templates of gridview and navigate to the linkbutton cell. Doule click on that will generate click event for link button.
In the click event get the row and then get dropdownlist and set its visibility.

linkbutton_Click(......)
{
LinkButton lnb=(LinkButton)sender;
TableRow tRow=(TableRow)lnb.Parent.Parent;
DropdownList ddl=(DropdownList)tRow.FindControl(yourdropdown ID);
ddl.visible=true;
//Write your code here for binding dropdwon list

}


Hope this helps.

But when you are about to ask a question please try something on your own and If are you unable to get it then ask a question otherwise you will learn nothing.

Happy Coding.

Regards
Sriman


这篇关于在onclick事件上生成动态下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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