OnTextChanged not working

Discussion in 'ASP .Net Web Controls' started by kj, May 15, 2007.

  1. kj

    kj Guest

    Please bare with me, I am very new to ASP. Basically I have created
    a
    program that displays 2 textboxes and 2 buttons. The first button
    displays a file chooser window to allow the user to select a file.
    This then populates textbox1 on the form.

    However, I was trying to create a change event where when textbox1 is
    populated it will automatically populate textbox2 with the value in
    the first textbox. (I am going to change the code to display only
    part of the textbox1 value, but right now I am just trying to get it
    to populate the 2nd textbox.) The 1st portion is working correctly,
    but I can't get
    textbox2 populated. Can someone one please help me out?


    Below is the portion of the code that creates the textboxes and file
    chooser window.
    <td colspan="2">
    <center><input
    id="fileChooserHidden" style="DISPLAY: none; WIDTH:30%" type="file"
    name="fileChooser" runat="server"
    onchange="this.form.txtFileChooser.value =
    this.form.fileChooserHidden.value"/></center>
    <center><asp:Label
    ID="lblImportFile" runat="server" Font-Bold="false" Text="Select File
    to Import " Width="113px"></asp:Label></center>
    <center><asp:textbox
    id="txtFileChooser" runat="server" Width="345px" AutoPostBack="true"
    OnTextChanged="Import_TextChanged"></asp:textbox></center>&nbsp;
    <center><input type="button"
    id="btnBrowse" style="WIDTH: 10%"
    onclick="javascript:this.form.fileChooserHidden.click()"
    class="button" value="Browse" /></center>
    <br />
    <br />
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <center><asp:Label
    ID="lblExportTo" runat="server" Font-Bold="false" Text="Export To:
    "></asp:Label></center>
    <center><asp:TextBox
    ID="txtExportTo" runat="server" Font-Bold="false" Width="345px"></
    asp:TextBox></center>&nbsp;
    <center><asp:Button
    ID="cmdExport" runat="server" OnClick="Export_Click" Text="Export"
    Width="75px" /></center>
    <br />
    <br />
    </td>


    And this is my client side code:


    public void Import_TextChanged(object sender, System.EventArgs e)
    {
    txtExportTo.Text = txtFileChooser.Text;
    }
     
    kj, May 15, 2007
    #1
    1. Advertising

  2. kj

    Peter Guest

    kj wrote:
    > Please bare with me, I am very new to ASP. Basically I have created
    > a
    > program that displays 2 textboxes and 2 buttons. The first button
    > displays a file chooser window to allow the user to select a file.
    > This then populates textbox1 on the form.
    >
    > However, I was trying to create a change event where when textbox1 is
    > populated it will automatically populate textbox2 with the value in
    > the first textbox. (I am going to change the code to display only
    > part of the textbox1 value, but right now I am just trying to get it
    > to populate the 2nd textbox.) The 1st portion is working correctly,
    > but I can't get
    > textbox2 populated. Can someone one please help me out?
    >
    >
    > Below is the portion of the code that creates the textboxes and file
    > chooser window.
    > <td colspan="2">
    > <center><input
    > id="fileChooserHidden" style="DISPLAY: none; WIDTH:30%" type="file"
    > name="fileChooser" runat="server"
    > onchange="this.form.txtFileChooser.value =
    > this.form.fileChooserHidden.value"/></center>
    > <center><asp:Label
    > ID="lblImportFile" runat="server" Font-Bold="false" Text="Select File
    > to Import " Width="113px"></asp:Label></center>
    > <center><asp:textbox
    > id="txtFileChooser" runat="server" Width="345px" AutoPostBack="true"
    > OnTextChanged="Import_TextChanged"></asp:textbox></center>&nbsp;
    > <center><input type="button"
    > id="btnBrowse" style="WIDTH: 10%"
    > onclick="javascript:this.form.fileChooserHidden.click()"
    > class="button" value="Browse" /></center>
    > <br />
    > <br />
    > </td>
    > </tr>
    > <tr>
    > <td colspan="2">
    > <center><asp:Label
    > ID="lblExportTo" runat="server" Font-Bold="false" Text="Export To:
    > "></asp:Label></center>
    > <center><asp:TextBox
    > ID="txtExportTo" runat="server" Font-Bold="false" Width="345px"></
    > asp:TextBox></center>&nbsp;
    > <center><asp:Button
    > ID="cmdExport" runat="server" OnClick="Export_Click" Text="Export"
    > Width="75px" /></center>
    > <br />
    > <br />
    > </td>
    >
    >
    > And this is my client side code:
    >
    >
    > public void Import_TextChanged(object sender, System.EventArgs e)
    > {
    > txtExportTo.Text = txtFileChooser.Text;
    > }
    >

    set AutoPostBack="True" on the field where the ontexchanged event is
    being fired from.
     
    Peter, May 16, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henri
    Replies:
    6
    Views:
    748
    Henri
    Aug 6, 2004
  2. =?Utf-8?B?TmVpbA==?=

    OnTextChanged not firing??

    =?Utf-8?B?TmVpbA==?=, Oct 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    4,262
    =?Utf-8?B?TWFyeUE=?=
    Aug 29, 2005
  3. onTextChanged not firing

    , Feb 1, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    14,384
    =?Utf-8?B?c2FyYQ==?=
    Feb 2, 2005
  4. mdipiet
    Replies:
    1
    Views:
    1,203
  5. Eidolon

    OnTextChanged in datagrid not working

    Eidolon, May 19, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    125
    Vidar Petursson
    May 20, 2004
Loading...

Share This Page