nefunguje findcontrol z listview v asp.net
Napsal: úte 21. pro 2010, 20:57
Mám problém v ASP.NETu, mám vytvořený listview a v souboru cs chci načíst hodnoty z textboxu, ten textbox je v EditItemTemplate, ale prostě ani zaboha nevím jak tu hodnotu načíst.
aspx soubor
cs soubor
ten findcontrol bohužel nefunguje a zkoušel jsem i jiné blboviny viz google, snažím se na to přijít už 2 dny, ale pořád nic. Tak už píšu sem.
Nevíte tedy někdo?
aspx soubor
Kód: Vybrat vše
<asp:ListView ID="ListView1" runat="server" DataKeyNames="id_users" InsertItemPosition="FirstItem"
DataSourceID="SqlDataSource1">
.
.
.
<EditItemTemplate>
<tr>
<td>
<asp:Button ID="UpdateButton" runat="server" CommandName="Update" OnClick="btnUlozUser_Click"
Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Cancel" />
</td>
<td>
<asp:Label ID="eid_usersLabel1" runat="server" Text='<%# Eval("id_users") %>' />
</td>
<td>
<asp:TextBox ID="euziv_jmenoTextBox" runat="server"
Text='<%# Bind("uziv_jmeno") %>' />
</td>
<td>
<asp:TextBox ID="ehesloTextBox" runat="server" Text='<%# Bind("heslo") %>' />
</td>
<td>
<asp:TextBox ID="eemailTextBox" runat="server" Text='<%# Bind("email") %>' />
</td>
<td>
<asp:DropDownList ID="eaktivniTextBox" runat="server" SelectedValue='<%# Bind("aktivni") %>'>
<asp:ListItem Value="1">ano</asp:ListItem>
<asp:ListItem Value="0">ne</asp:ListItem>
</asp:DropDownList>
</td>
<td>
<asp:TextBox ID="eprofiles_idprofilesTextBox" runat="server"
Text='<%# Bind("profiles_idprofiles") %>' />
</td>
</tr>
</EditItemTemplate>
.
.
.
cs soubor
Kód: Vybrat vše
protected void btnUlozUser_Click(object sender, EventArgs e)
{
.
.
.
TextBox iduser = (ListView1.FindControl("eid_usersLabel1") as TextBox);
.
.
.
}
Nevíte tedy někdo?