- Joined
- Mar 2, 2007
- Messages
- 1
- Reaction score
- 0
Hi to all!
I'm using a FormView control heavily customized and I need to enable some inner textboxes when the user write something in another inner textbox. So I need to use inner controls events but ... they seem not to work!
I wrote something like that:
<asp:FormView ID="fv" runat="server" AllowPaging="True" DataKeyNames="id" DataSourceID="dsMain" DefaultMode="Insert" Width="760px">
<EditItemTemplate>
....
</EditItemTemplate>
<InsertItemTemplate>
....
<asp:TextBox ID="s1a101TextBox" runat="server" Text='<%# Bind("s1a101") %>' Width="500px" OnTextChanged="s1a101TextBox_TextChanged"></asp:TextBox>
....
</InsertItemTemplate>
....
</asp:FormView>
Partial Class _Default Inherits System.Web.UI.Page
Protected Sub s1a101TextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim t1 As TextBox
t1 = fv.FindControl("s1a101TextBox")
If t1.Text = "hi!" Then
lblTest.Text = “OK”
Else
lblTest.Text = “NO”
End If
End Sub
End Class
but it absolutly doesn't work! I used breakpoints in the Sub and I saw that the code is never executed.
Could you please help me? Thank you very much in advance.
Stefano
I'm using a FormView control heavily customized and I need to enable some inner textboxes when the user write something in another inner textbox. So I need to use inner controls events but ... they seem not to work!
I wrote something like that:
<asp:FormView ID="fv" runat="server" AllowPaging="True" DataKeyNames="id" DataSourceID="dsMain" DefaultMode="Insert" Width="760px">
<EditItemTemplate>
....
</EditItemTemplate>
<InsertItemTemplate>
....
<asp:TextBox ID="s1a101TextBox" runat="server" Text='<%# Bind("s1a101") %>' Width="500px" OnTextChanged="s1a101TextBox_TextChanged"></asp:TextBox>
....
</InsertItemTemplate>
....
</asp:FormView>
Partial Class _Default Inherits System.Web.UI.Page
Protected Sub s1a101TextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim t1 As TextBox
t1 = fv.FindControl("s1a101TextBox")
If t1.Text = "hi!" Then
lblTest.Text = “OK”
Else
lblTest.Text = “NO”
End If
End Sub
End Class
but it absolutly doesn't work! I used breakpoints in the Sub and I saw that the code is never executed.
Could you please help me? Thank you very much in advance.
Stefano