Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > OnTextChanged not working

Reply
Thread Tools

OnTextChanged not working

 
 
kj
Guest
Posts: n/a
 
      05-15-2007
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.cl ick()"
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;
}

 
Reply With Quote
 
 
 
 
Peter
Guest
Posts: n/a
 
      05-16-2007
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.cl ick()"
> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnTextChanged not firing?? =?Utf-8?B?TmVpbA==?= ASP .Net 3 08-29-2005 08:54 AM
onTextChanged event not firing with ENTER key mdipiet ASP .Net 1 05-11-2005 08:05 PM
onTextChanged not firing kbrandl@gmail.com ASP .Net 3 02-02-2005 03:25 PM
textbox's state does not persist if onTextChanged not defined Henri ASP .Net 6 08-06-2004 02:08 PM
OnTextChanged in datagrid not working Eidolon ASP .Net Web Controls 1 05-20-2004 03:14 AM



Advertisments