Gridview 裡面有兩個下拉控制項
這兩個控制像分別有事件 透過 parent 找控制項 跟 NamingContainer 找控制項
protected void ddlWSEQ_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlWSEQ = (DropDownList)sender;
TextBox txtSYEAR = ddlWSEQ.Parent.FindControl("txtSYEAR") as TextBox;
}
protected void ddlITEM_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlITEM2 = sender as DropDownList;
TextBox txtBELONGITEM = ddlITEM2.NamingContainer.FindControl("txtBELONGITEM") as TextBox;
txtBELONGITEM.Text = ddlITEM2.SelectedValue;
}
沒有留言:
張貼留言