Solved

c#, asp.net - filling a text box when FileUpload textbox is filled

Posted on 2009-05-05
3
1,690 Views
Last Modified: 2012-05-06
Hi,

I want to populate a textbox with the text of the textbox in a FileUpload.Once a file has been choosen and placed in the fileupload text box I want  textbox ID="fakefilepc"  to display the same text.  Does anyone know how to do this?

thanks
<asp:FileUpload ID="picFileUploadPhoto" runat="server" Width="250px" ></asp:FileUpload>// file to take Text from
 
 
 
<asp:TextBox ID="fakefilepc" runat="server"></asp:TextBox>// populate this text box

Open in new window

0
Comment
Question by:CharlieDev
3 Comments
 
LVL 7

Expert Comment

by:Maverick_Cool
ID: 24303323
fakefilepc.text = picFileUploadPhoto.PostedFile.FileName;
0
 
LVL 4

Accepted Solution

by:
cauos earned 500 total points
ID: 24303325
add this javascript function to your page
<script language="javascript">
function change()
{
var obj1 = document.getElementById("picFileUploadPhoto")
var obj2 = document.getElementById("fakefilepc")
obj2.value=obj1.value
}
</script>
and this event to the file uploader
<asp:FileUpload ID="picFileUploadPhoto" onchange="change()"  runat="server" />
0
 

Author Closing Comment

by:CharlieDev
ID: 31577949
Thanks!!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question