Hallo.
Jetzt könnt ich ausflippen. Ich mach ein ganz einfache Sach
Ich will einem control im code ein control aus der site zuweisen.
Das wollte ich mit findControl machen. Aber das bringtnull.
jetzt der 'Code'
Ich weiss dass die Textbox da ist. Wieso findet der Code sie nicht?
ciao und danke
Jetzt könnt ich ausflippen. Ich mach ein ganz einfache Sach
Ich will einem control im code ein control aus der site zuweisen.
Das wollte ich mit findControl machen. Aber das bringtnull.
Code:
<tr>
<td style="width: 48px">
08.30-09.15</td>
<td style="width: 136px">
<asp:TextBox ID="tbl1" runat="server" Height="16px" Width="61px" AutoPostBack="True"></asp:TextBox>
<asp:ImageButton ID="img1" runat="server" Height="16px"
ImageUrl="~/App_Themes/Icons/icons/Edit.png" Width="16px"
onclick="imgb_Click" />
<asp:DropDownList ID="ddll1" runat="server" Height="16px" Width="62px"
Visible="False">
</asp:DropDownList>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
jetzt der 'Code'
Code:
TextBox myControl1 = FindControl("tbl1") as TextBox ;
if (myControl1 != null)
{
Control myControl2 = myControl1.Parent;
Response.Write("Parent of the text box is : " + myControl2.ID);
}
else
{
Response.Write("Control not found");
}
Ich weiss dass die Textbox da ist. Wieso findet der Code sie nicht?
ciao und danke