本文介绍了在同一下拉列表中的DropDown的SelectedIndexCahnge中执行CommandButton的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的Gridview中,有一个DropdownList(ddlProjectCode1)&命令按钮(cmdButton1)
此命令按钮单击的代码在Griview_RowCommand事件中.
我想在dropdownList(ddlProjectCode1)的选定索引更改上执行 this 代码
您能完成代码吗?
-------------------------------------------------- ------------------------
In My Gridview there is a DropdownList(ddlProjectCode1) & a Command Button (cmdButton1)
the code for this command button click is within Griview_RowCommand event.
I want execute this code on selected index change of dropdownList(ddlProjectCode1)
Can you complete the code.
--------------------------------------------------------------------------
protected void ddlProjectCode1_OnSelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlthis = (DropDownList)sender;
GridViewRow gvrow = (GridViewRow)ddlthis.Parent.Parent;
Button cmdButton1 = (Button)gvrow.FindControl("cmdButton1");
}
推荐答案
protected void ddlProjectCode1_OnSelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlthis = (DropDownList)sender;
GridViewRow gvrow = (GridViewRow)ddlthis.Parent.Parent;
//Call the command button event
cmdButton1_OnSelectedIndexChanged(object sender, EventArgs e)
}
这篇关于在同一下拉列表中的DropDown的SelectedIndexCahnge中执行CommandButton的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!