OnTextChanged not working

K

kj

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;
}
 
P

Peter

kj said:
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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top