Control fc = FindControl("ddl1"); if (fc != null) { Control c2 = fc.Parent; Response.Write("parent of the textbox is :" + c2.ID); } else { Response.Write("control not found"); }
private void btnsave_Click(object sender, EventArgs MyEventArgs) { Control myControl1 = FindControl("ddl1"); if(myControl1!=null) { Control myControl2 = myControl1.Parent; Response.Write("Parent of the text box is : " + myControl2.ID); } else { Response.Write("Control not found"); } }
<asp:panel id="pnl" runat="server"> <asp:DropDownList ID="ddl1" runat="server" /> </asp:panel>
Control ctrl = pnl.FindControl("ddl1");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)