FormView and inner control events

Discussion in 'ASP .Net Building Controls' started by Stefano, Mar 2, 2007.

  1. Stefano

    Stefano Guest

    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
     
    Stefano, Mar 2, 2007
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.