我gridview在 ASP 中有一个,template Fields包含和链接每一行,以及包含链接的页脚。selecteditdeleteinsert
dropdownlists每行有两个,比方说:Category和sub-category,当我更改内容时category DropDownList,sub-category DropDownList应该自动显示相应的内容。
我试图编写一个onSelectedIndexChanged处理程序,但我不知道如何继续。有任何想法吗? (请记住,我完成了所有的 rowDataBound() 代码来填充下拉列表)
换句话说,如何填充除 row_databound() 之外的下拉列表
代码:
protected void grdBulkScheduler_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList ddlCategory = (DropDownList)e.Row.FindControl("ddlCategory");
if (ddlCategory != null)
{
ddlCategory .DataSource = cData.GetCategory();
ddlCategory .DataValueField = "c_ID";
ddlCategory .DataTextField = "c_Text";
ddlCategory .DataBind();
}
在这里,我从GridViewRowEventArgs中找到下拉列表类别
在 selectedIndexChanged 处理程序中,如何找到 DropDownList? 因为
DropDownList ddlCategory = (DropDownList)e.Row.FindControl("ddlCategory")不工作