Solved

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

Posted on 2009-05-05
3
1,684 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
Comment Utility
fakefilepc.text = picFileUploadPhoto.PostedFile.FileName;
0
 
LVL 4

Accepted Solution

by:
cauos earned 500 total points
Comment Utility
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
Comment Utility
Thanks!!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now