![]() |
OnTextChanged not working
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> <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> <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; } |
Re: OnTextChanged not working
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> > <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> > <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. |
| All times are GMT. The time now is 08:58 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.