How to change Text in FileUpload controlhttp://forums.asp.net/t/1121953.aspx/1?How+to+change+Text+in+FileUpload+controlMon, 07 Mar 2011 12:45:33 -050011219531753958http://forums.asp.net/p/1121953/1753958.aspx/1?How+to+change+Text+in+FileUpload+controlHow to change Text in FileUpload control <p>Can we change text of Browse Button in FileUpload Control to Other language? Am working on Localization. Am not able to change name cause When i generate Local Resource file for FileUPload component only this comes (FileUpload1Resource1.ToolTip). I want to change Button Text. How can i change?</p> 2007-06-14T03:07:39-04:001754588http://forums.asp.net/p/1121953/1754588.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>I'm not sure you can change it.</p> <p>I did it this way: </p> <ol> <li>&lt;div mce_keep=&quot;true&quot;&gt;make a button (for instance an input; it doesn't even have to run at server)&lt;/div&gt; </li><li>&lt;div mce_keep=&quot;true&quot;&gt;when the button is clicked, perform some javascript&lt;/div&gt; </li><li>&lt;div mce_keep=&quot;true&quot;&gt;the javascript will get the fileInput, and perform the click on it.&lt;/div&gt; </li><li>&lt;div mce_keep=&quot;true&quot;&gt;the 'Open File'-dialog is opened by pressing on a button you can modify any way you want.&lt;/div&gt; </li><li>&lt;div mce_keep=&quot;true&quot;&gt;Hide the fileInput control&lt;/div&gt;</li></ol> <p>Hope this helps!<br> Wim</p> 2007-06-14T11:38:51-04:001754800http://forums.asp.net/p/1121953/1754800.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>Hi there, two questions:</p> <p>1) Have you set the Language UI thread of the site?</p> <p>2) Have you set tried setting your OS to a different language?</p> <p>&nbsp;I ask becuase if your using the asp.net control then I beleive it will use the default settings for the language of the control, but I'm not sure if it takes the language from the thread or the OS so worth setting Windows to another Language to see what language the button appears as.</p> <p>&nbsp;</p> <p>Michael<br> &nbsp;</p> 2007-06-14T14:14:46-04:001761144http://forums.asp.net/p/1121953/1761144.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>Hi,</p> <p>As far as I know, we cannot localize the file upload dialog box. It is a client call and its language depends on the language of the OS on the client side.</p> <p>If you just wish to change the language on the click button, you can use deblendewim's suggestion, to make a file upload control yourself. The only way to change the file open dialog box is to construct an ActiveX control of your own to do this.</p> <p>If this does not answer your question, please feel free to mark the post as Not Answered and reply. Thank you!</p> 2007-06-19T09:14:19-04:001835789http://forums.asp.net/p/1121953/1835789.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>Hi,</p> <p>I'm trying to do what you said... but my javascript is not working Could you show me you javascript (step 3) pls?</p> <p>&nbsp;</p> <p>Thanks in advance</p> 2007-08-01T18:15:12-04:001836945http://forums.asp.net/p/1121953/1836945.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>Hi rdelgadoj,</p> <p>Here is a complete example. Both buttons trigger the hidden input (type=&quot;file&quot;) element. One button is a html button (pure clientside), the other button is the asp:button.</p> <p>&nbsp;<pre class="prettyprint">&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &gt; &lt;head runat=&quot;server&quot;&gt; &lt;title&gt;Untitled Page&lt;/title&gt; &lt;script type=&quot;text/javascript&quot;&gt; function triggerFileUpload() { document.getElementById(&quot;File1&quot;).click(); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt; &lt;div&gt; &lt;input id=&quot;File1&quot; type=&quot;file&quot; style=&quot; visibility:hidden;&quot; /&gt; &lt;br /&gt; &lt;br /&gt; &lt;asp:Button ID=&quot;Button1&quot; OnClientClick=&quot;triggerFileUpload()&quot; runat=&quot;server&quot; Text=&quot;ASPNET Button&quot; /&gt; &lt;br /&gt; &lt;br /&gt; &lt;input id=&quot;Button2&quot; type=&quot;button&quot; onclick=&quot;triggerFileUpload()&quot; value=&quot;HTML Button&quot; /&gt; &lt;br /&gt; &lt;br /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</pre> </p> <p>&nbsp;If you have any other questions/remarks, please let me know.</p> <p>Good luck!<br> Wim</p> 2007-08-02T07:40:18-04:001840086http://forums.asp.net/p/1121953/1840086.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>Hi Wim,</p> <p>Thanks very much.</p> <p>This is working fine!, but, &nbsp;I realize that if I put &quot;runat=&quot;server&quot;&quot; to the File1 object, the &quot;File Browser&quot; window&nbsp;is not raised. I need to get the posted file in the &quot;CodeBehind&quot;... How do I do this?</p> <p>&nbsp;</p> <p>Thanks!</p> 2007-08-03T14:57:46-04:001849279http://forums.asp.net/p/1121953/1849279.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>Hi rdelgadoj,</p> <p>Sorry for my late reply ....</p> <p>I think that the value of the input control (type=file) is not remembered during postback.<br> One thing is weird: If I put runat=&quot;server&quot; on my File1 control, it still gets triggered and the Open File Dialog still pop's up? (But, it doesn't have to be runat=&quot;server&quot; since the value isn't remembered during postback)</p> <p>&nbsp;</p> <p>You can solve this by doing the following ....</p> <ol> <li>&lt;div mce_keep=&quot;true&quot;&gt;in the input control (type=file) you have an event onchange. &lt;/div&gt; </li><li>&lt;div mce_keep=&quot;true&quot;&gt;This event gets triggered whenever the value of the control changes&lt;/div&gt; </li><li>&lt;div mce_keep=&quot;true&quot;&gt;When that occurs, call a javascript function to get the value of the input-control (type=file) &lt;/div&gt; </li><li>&lt;div mce_keep=&quot;true&quot;&gt;Store that value in an input-control (type=hidden) &lt;/div&gt; </li><li>&lt;div mce_keep=&quot;true&quot;&gt;make sure the input control (type=hidden) is runat=&quot;server&quot;.&lt;/div&gt; </li><li>&lt;div mce_keep=&quot;true&quot;&gt;then in code-behind, get the value out of the hidden input control. (This value is remembered during postback!)&lt;/div&gt;</li></ol> <p>Here is an example:</p> <p>html:</p> <p>&nbsp;<pre class="prettyprint">&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &gt; &lt;head id=&quot;Head1&quot; runat=&quot;server&quot;&gt; &lt;title&gt;Untitled Page&lt;/title&gt; &lt;script type=&quot;text/javascript&quot;&gt; function triggerFileUpload() { document.getElementById(&quot;File1&quot;).click(); } function setHiddenValue() { document.getElementById(&quot;Hidden1&quot;).value = document.getElementById(&quot;File1&quot;).value; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt; &lt;div&gt; &lt;input runat=&quot;server&quot; id=&quot;Hidden1&quot; type=&quot;hidden&quot; /&gt; &lt;input runat=&quot;server&quot; id=&quot;File1&quot; type=&quot;file&quot; onchange=&quot;setHiddenValue()&quot; style=&quot; visibility:hidden;&quot; /&gt; &lt;br /&gt; &lt;br /&gt; &lt;asp:Button ID=&quot;Button1&quot; OnClientClick=&quot;triggerFileUpload()&quot; runat=&quot;server&quot; Text=&quot;ASPNET Button&quot; /&gt; &lt;br /&gt; &lt;br /&gt; &lt;input id=&quot;Button2&quot; type=&quot;button&quot; onclick=&quot;triggerFileUpload()&quot; value=&quot;HTML Button&quot; /&gt; &lt;br /&gt; &lt;br /&gt; &lt;asp:Button ID=&quot;Button3&quot; runat=&quot;server&quot; Text=&quot;Go CodeBehind To Get Input Value&quot; /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</pre> <P>&nbsp;code-behind:</P><pre class="prettyprint">Partial <SPAN class=kwd>Class</SPAN> _Default <SPAN class=kwd>Inherits</SPAN> System.Web.UI.Page <SPAN class=kwd>Protected Sub</SPAN> Button3_Click(<SPAN class=kwd>ByVal</SPAN> sender <SPAN class=kwd>As Object</SPAN>, <SPAN class=kwd>ByVal</SPAN> e <SPAN class=kwd>As</SPAN> System.EventArgs) <SPAN class=kwd>Handles</SPAN> Button3.Click <SPAN class=kwd>Dim</SPAN> inputValue <SPAN class=kwd>As String</SPAN> inputValue = <SPAN class=kwd>Me</SPAN>.Hidden1.Value <SPAN class=kwd>End Sub End Class</SPAN></pre> </p> <p>&nbsp;Hope this helps!<br> Wim</p> 2007-08-09T09:30:51-04:001850287http://forums.asp.net/p/1121953/1850287.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>Win,</p> <p>Thanks a lot! This solved my problem.</p> <p>&nbsp;I have to fix some issues because I'm working with master page, so, I have ContentPlaceHolder that changes the client's name controls and&nbsp;also&nbsp;I'm using an UpdatePanel (UpdatePanels do not supports FileUploads)....</p> <p>&nbsp;</p> <p>This is great!</p> <p>&nbsp;Again Thanks a lot!</p> 2007-08-09T16:40:15-04:001915953http://forums.asp.net/p/1121953/1915953.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>[:(]i want your help plzzzzzzzzzzzzzzz.</p> <p>this code is run in html page and I'm using aspx page with masterpage so can you help me to get the same code that can work in my project plz.</p> <p>thx </p> 2007-09-19T09:23:49-04:001916243http://forums.asp.net/p/1121953/1916243.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>Hi ahmed,</p> <p>The code given is actually an aspx page. Only the content inside the &lt;html&gt;&lt;/html&gt; is given.</p> <p>&nbsp;</p> <p>Can you be a bit more specific&nbsp;about what you want to achieve? Do you want your customized fileupload on the master, child?<br> How do you want to customize it etc.</p> <p>Did you try to add the above code to your application?<br> Do you get errors, what goes wrong?</p> <p>&nbsp;</p> <p>Kind regards,<br> Wim</p> 2007-09-19T12:35:36-04:001918276http://forums.asp.net/p/1121953/1918276.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>thx Wim for replaying me.</p> <p>look Wim that is the code I write it and it doesn't work see it and replay me ok thx .</p> <p>&nbsp;</p> <p>&nbsp;</p> <font size="2"> <p>&lt;%</font><font color="#0000ff" size="2">@</font><font size="2"> </font><font color="#800000" size="2">Page</font><font size="2"> </font><font color="#ff0000" size="2">Language</font><font color="#0000ff" size="2">=&quot;C#&quot;</font><font size="2"> </font><font color="#ff0000" size="2">MasterPageFile</font><font color="#0000ff" size="2">=&quot;~/MasterPage2.master&quot;</font><font size="2"> </font><font color="#ff0000" size="2">AutoEventWireup</font><font color="#0000ff" size="2">=&quot;true&quot;</font><font size="2"> </font><font color="#ff0000" size="2">CodeFile</font><font color="#0000ff" size="2">=&quot;final.aspx.cs&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Inherits</font><font color="#0000ff" size="2">=&quot;test_Default&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Title</font><font color="#0000ff" size="2">=&quot;Untitled Page&quot;</font><font size="2"> %&gt;</p> </font><font color="#0000ff" size="2"> <p>&lt;</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">Content</font><font size="2"> </font><font color="#ff0000" size="2">ID</font><font color="#0000ff" size="2">=&quot;Content1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">ContentPlaceHolderID</font><font color="#0000ff" size="2">=&quot;ContentPlaceHolder1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Runat</font><font color="#0000ff" size="2">=&quot;Server&quot;&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">script</font><font size="2"> </font><font color="#ff0000" size="2">language</font><font color="#0000ff" size="2">=&quot;JavaScript&quot;&gt;</p> </font><font size="2"> <p>&lt;!--</p> </font><font color="#008000" size="2"> <p>&nbsp;</p> </font><font color="#0000ff" size="2">function</font><font size="2"> fireFileClick()</font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">var</font><font size="2"> objfile = document.getElementById(</font><font color="#800000" size="2">'File1'</font><font size="2">);</font><font size="2"> <p>objfile.click();</p> </font><font color="#0000ff" size="2">var</font><font size="2"> objTextBox = document.getElementById(</font><font color="#800000" size="2">'Text1'</font><font size="2">);</font><font size="2"> <p>objTextBox.value = objfile.value;</p> <p>}</p> </font><font color="#0000ff" size="2">function</font><font size="2"> setHiddenValue()</font><font size="2"> <p>{</p> document.getElementById(</font><font color="#800000" size="2">&quot;Hidden1&quot;</font><font size="2">).value = document.getElementById(</font><font color="#800000" size="2">&quot;File1&quot;</font><font size="2">).value;</font><font size="2"> <p>}</p> </font><font color="#008000" size="2"> <p>// --&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;/</font><font color="#800000" size="2">script</font><font color="#0000ff" size="2">&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">input</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">=&quot;Hidden1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">type</font><font color="#0000ff" size="2">=&quot;hidden&quot;</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">input</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">=&quot;server&quot;</font><font size="2"> </font><font color="#ff0000" size="2">onchange</font><font color="#0000ff" size="2">=&quot;setHiddenValue()&quot;</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">=&quot;File1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">type</font><font color="#0000ff" size="2">=&quot;file&quot;</font><font size="2"> </font><font color="#ff0000" size="2">style</font><font color="#0000ff" size="2">=&quot; visibility:hidden;&quot;</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">br</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">br</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">Button</font><font size="2"> </font><font color="#ff0000" size="2">ID</font><font color="#0000ff" size="2">=&quot;Button1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">OnClientClick</font><font color="#0000ff" size="2">=&quot;fireFileClick()&quot;</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">=&quot;server&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Text</font><font color="#0000ff" size="2">=&quot;ASPNET Button&quot;</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">input</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">=&quot;Text1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">type</font><font color="#0000ff" size="2">=&quot;text&quot;</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">br</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">br</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">input</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">=&quot;Button2&quot;</font><font size="2"> </font><font color="#ff0000" size="2">type</font><font color="#0000ff" size="2">=&quot;button&quot;</font><font size="2"> </font><font color="#ff0000" size="2">onclick</font><font color="#0000ff" size="2">=&quot;fireFileClick()&quot;</font><font size="2"> </font><font color="#ff0000" size="2">value</font><font color="#0000ff" size="2">=&quot;HTML Button&quot;</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">br</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">br</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</font><font color="#0000ff" size="2"> <p>&nbsp;</p> <p>&lt;/</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">Content</font><font color="#0000ff" size="2">&gt;</p> </font> 2007-09-20T11:51:01-04:001918277http://forums.asp.net/p/1121953/1918277.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>thx Wim for replaying me.</p> <p>look Wim that is the code I write it and it doesn't work see it and replay me ok thx .</p> <p>&nbsp;</p> <p>&nbsp;</p> <font size="2"> <p>&lt;%</font><font color="#0000ff" size="2">@</font><font size="2"> </font><font color="#800000" size="2">Page</font><font size="2"> </font><font color="#ff0000" size="2">Language</font><font color="#0000ff" size="2">=&quot;C#&quot;</font><font size="2"> </font><font color="#ff0000" size="2">MasterPageFile</font><font color="#0000ff" size="2">=&quot;~/MasterPage2.master&quot;</font><font size="2"> </font><font color="#ff0000" size="2">AutoEventWireup</font><font color="#0000ff" size="2">=&quot;true&quot;</font><font size="2"> </font><font color="#ff0000" size="2">CodeFile</font><font color="#0000ff" size="2">=&quot;final.aspx.cs&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Inherits</font><font color="#0000ff" size="2">=&quot;test_Default&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Title</font><font color="#0000ff" size="2">=&quot;Untitled Page&quot;</font><font size="2"> %&gt;</p> </font><font color="#0000ff" size="2"> <p>&lt;</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">Content</font><font size="2"> </font><font color="#ff0000" size="2">ID</font><font color="#0000ff" size="2">=&quot;Content1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">ContentPlaceHolderID</font><font color="#0000ff" size="2">=&quot;ContentPlaceHolder1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Runat</font><font color="#0000ff" size="2">=&quot;Server&quot;&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">script</font><font size="2"> </font><font color="#ff0000" size="2">language</font><font color="#0000ff" size="2">=&quot;JavaScript&quot;&gt;</p> </font><font size="2"> <p>&lt;!--</p> </font><font color="#008000" size="2"> <p>&nbsp;</p> </font><font color="#0000ff" size="2">function</font><font size="2"> fireFileClick()</font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">var</font><font size="2"> objfile = document.getElementById(</font><font color="#800000" size="2">'File1'</font><font size="2">);</font><font size="2"> <p>objfile.click();</p> </font><font color="#0000ff" size="2">var</font><font size="2"> objTextBox = document.getElementById(</font><font color="#800000" size="2">'Text1'</font><font size="2">);</font><font size="2"> <p>objTextBox.value = objfile.value;</p> <p>}</p> </font><font color="#0000ff" size="2">function</font><font size="2"> setHiddenValue()</font><font size="2"> <p>{</p> document.getElementById(</font><font color="#800000" size="2">&quot;Hidden1&quot;</font><font size="2">).value = document.getElementById(</font><font color="#800000" size="2">&quot;File1&quot;</font><font size="2">).value;</font><font size="2"> <p>}</p> </font><font color="#008000" size="2"> <p>// --&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;/</font><font color="#800000" size="2">script</font><font color="#0000ff" size="2">&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">input</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">=&quot;Hidden1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">type</font><font color="#0000ff" size="2">=&quot;hidden&quot;</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">input</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">=&quot;server&quot;</font><font size="2"> </font><font color="#ff0000" size="2">onchange</font><font color="#0000ff" size="2">=&quot;setHiddenValue()&quot;</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">=&quot;File1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">type</font><font color="#0000ff" size="2">=&quot;file&quot;</font><font size="2"> </font><font color="#ff0000" size="2">style</font><font color="#0000ff" size="2">=&quot; visibility:hidden;&quot;</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">br</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">br</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">Button</font><font size="2"> </font><font color="#ff0000" size="2">ID</font><font color="#0000ff" size="2">=&quot;Button1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">OnClientClick</font><font color="#0000ff" size="2">=&quot;fireFileClick()&quot;</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">=&quot;server&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Text</font><font color="#0000ff" size="2">=&quot;ASPNET Button&quot;</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">input</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">=&quot;Text1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">type</font><font color="#0000ff" size="2">=&quot;text&quot;</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">br</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">br</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">input</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">=&quot;Button2&quot;</font><font size="2"> </font><font color="#ff0000" size="2">type</font><font color="#0000ff" size="2">=&quot;button&quot;</font><font size="2"> </font><font color="#ff0000" size="2">onclick</font><font color="#0000ff" size="2">=&quot;fireFileClick()&quot;</font><font size="2"> </font><font color="#ff0000" size="2">value</font><font color="#0000ff" size="2">=&quot;HTML Button&quot;</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">br</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">br</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</font><font color="#0000ff" size="2"> <p>&nbsp;</p> <p>&lt;/</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">Content</font><font color="#0000ff" size="2">&gt;</p> </font> 2007-09-20T11:51:04-04:001918298http://forums.asp.net/p/1121953/1918298.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>sorry for repeating it is my mistake sorry but i want to use upload file as standard not input becouse this control in about 40 page and i can't change the code from start again so try to help me [:)]</p> 2007-09-20T12:01:53-04:001918369http://forums.asp.net/p/1121953/1918369.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>Just for notice!&nbsp;</p> <p>The code posted by Win should work... the really issue here is What will&nbsp;we do with the file (file path or file name)?</p> <p>Post a file in a server is a little bit complicated, going on a step forward (after&nbsp;we get the file name in some way)... How do&nbsp;we post the file to the server? The HTTPPostedFile&nbsp;class has its &quot;FileName&quot; property as &quot;Read Only&quot;, also the &quot;FileName&quot; property of the UploadFile control... I spent a little time trying and finally I had to use the UploadFile as it. I improve a little the interface using this version of an UploadFile <a href="http://en.fileuploadajax.subgurim.net/">http://en.fileuploadajax.subgurim.net/</a>&nbsp;works fine, and so far it results stable.</p> <p>&nbsp;I hope help somebody</p> 2007-09-20T12:36:29-04:001920425http://forums.asp.net/p/1121953/1920425.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p></p> <blockquote><span class="icon-blockquote"></span> <h4>ahmed_fci2006</h4> <p></p> <p>thx Wim for replaying me.</p> <p>look Wim that is the code I write it and it doesn't work see it and replay me ok thx .</p> <p></p> </blockquote> &nbsp; <p></p> <p>Hi ahmed, </p> <p>You're right about the code not working ....</p> <p>The cause of this is the document.getElementById. On a masterPage, when the page gets rendered to be displayed (meaning the master and content-page will merge) the ID's of the controls get a different name than the one you declared them with. Just do a view source in your browser to see it for yourself.</p> <p>&nbsp;</p> <p>So a working solution is this ....</p> <p>&nbsp;</p> <pre class="prettyprint">&lt;%@ Page Language=&quot;VB&quot; MasterPageFile=&quot;~/MasterPage.master&quot; AutoEventWireup=&quot;false&quot; CodeFile=&quot;Default3.aspx.vb&quot; Inherits=&quot;Default3&quot; title=&quot;Untitled Page&quot; %&gt; &lt;asp:Content ID=&quot;Content1&quot; ContentPlaceHolderID=&quot;ContentPlaceHolder1&quot; Runat=&quot;Server&quot;&gt; &lt;script type=&quot;text/javascript&quot;&gt; &lt;!-- function fireFileClick() { var objfile = document.getElementById(&quot;&lt;%= File1.ClientID %&gt;&quot;); objfile.click(); var objTextBox = document.getElementById(&quot;&lt;%= Text1.ClientID %&gt;&quot;); objTextBox.value = objfile.value; } function setHiddenValue() { document.getElementById(&quot;&lt;%= Hidden1.ClientID %&gt;&quot;).value = document.getElementById(&quot;&lt;%= File1.ClientID %&gt;&quot;).value; } // --&gt; &lt;/script&gt; &lt;input id=&quot;Hidden1&quot; type=&quot;hidden&quot; runat=&quot;server&quot; /&gt; &lt;input runat=&quot;server&quot; onchange=&quot;setHiddenValue()&quot; id=&quot;File1&quot; type=&quot;file&quot; style=&quot; visibility:hidden;&quot; /&gt; &lt;br /&gt; &lt;br /&gt; &lt;asp:Button ID=&quot;Button1&quot; OnClientClick=&quot;fireFileClick()&quot; runat=&quot;server&quot; Text=&quot;ASPNET Button&quot; /&gt; &lt;input id=&quot;Text1&quot; type=&quot;text&quot; runat=&quot;server&quot; /&gt; &lt;br /&gt; &lt;br /&gt; &lt;input id=&quot;Button2&quot; type=&quot;button&quot; onclick=&quot;fireFileClick()&quot; value=&quot;HTML Button&quot; /&gt; &lt;br /&gt; &lt;br /&gt; &lt;/asp:Content&gt;</pre> <p>&nbsp;&nbsp;</p> <p>NOTE that this is a slightly different code example than your code of a contentpage so be careful when you take over the code!</p> <p>&nbsp;</p> <p>&nbsp;</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>ahmed_fci2006</h4> <p></p> i want to use upload file as standard not input <p></p> </blockquote> <p></p> <p>This is very easy:</p> <p>Just remove the input control and place a FileUpload-control on the page. Set it's visibility style to hidden.<br> Then just replace&nbsp; all occurances of File1 on the page with the id of the FileUpload control <br> I checked this and the functionality remains the same.</p> <p>&nbsp;</p> <p>If you have questions/remarks please do so!</p> <p>Kind regards,<br> Wim<br> </p> 2007-09-21T12:55:44-04:001920479http://forums.asp.net/p/1121953/1920479.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p></p> <blockquote><span class="icon-blockquote"></span> <h4>rdelgadoj</h4> <p></p> <p>Just for notice!&nbsp;</p> <p>The code posted by Win should work... the really issue here is What will&nbsp;we do with the file (file path or file name)?</p> <p>Post a file in a server is a little bit complicated, going on a step forward (after&nbsp;we get the file name in some way)... How do&nbsp;we post the file to the server? The HTTPPostedFile&nbsp;class has its &quot;FileName&quot; property as &quot;Read Only&quot;, also the &quot;FileName&quot; property of the UploadFile control... I spent a little time trying and finally I had to use the UploadFile as it. I improve a little the interface using this version of an UploadFile <a href="http://en.fileuploadajax.subgurim.net/">http://en.fileuploadajax.subgurim.net/</a>&nbsp;works fine, and so far it results stable.</p> <p>&nbsp;I hope help somebody</p> <p></p> </blockquote> &nbsp; <p></p> <p>Hi rdelgadoj,</p> <p>The net is full with examples about how to post a local file to the webserver once you got the FileName:</p> <p>Here are some links:</p> <p><a href="http://aspalliance.com/150_How_to_Upload_files_in_ASP_NET" target="_blank"><br> http://aspalliance.com/150_How_to_Upload_files_in_ASP_NET</a></p> <p>&nbsp;<a href="http://www.codeproject.com/aspnet/FileHandlerPackage.asp" target="_blank">http://www.codeproject.com/aspnet/FileHandlerPackage.asp</a></p> <p><a href="http://www.15seconds.com/issue/010504.htm" target="_blank">http://www.15seconds.com/issue/010504.htm</a></p> <p>&nbsp;</p> <p>If you have questions/remarks please do so!<br> Kind regards,<br> Wim<br> &nbsp;</p> 2007-09-21T13:22:10-04:001922290http://forums.asp.net/p/1121953/1922290.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>&nbsp;Wim thx the code working but [:(] there is two problem with me </p> <p>1- when I make fileupload visibility hidden &quot;visible=false&quot; the fileupload doesn't work.</p> <p>2-when make it visible it opens fileupload path but&nbsp; &quot;image path doesn't appear in file upload txt&quot;.</p> <p>[:(] I really don't know why it doesn't work with </p> <p>&nbsp;</p> 2007-09-23T08:31:42-04:001922401http://forums.asp.net/p/1121953/1922401.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p>Hi ahmed,</p> <p>I'm glad the code is working now ....</p> <p>To answer your questions:</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>ahmed_fci2006</h4> 1- when I make fileupload visibility hidden &quot;visible=false&quot; the fileupload doesn't work.</blockquote> <p></p> <p>When you set the property visible of the control to false, this is a parameter that will be handled on the server-side when the page gets rendered.<br> What I'm trying to say is: When you set that property to false, when the page renders, it just doesn't create the button!!!</p> <p>Look at the source (through the browser) of the page when the page is loaded and you have set the visible-property of the control to false. The control just isn't there.</p> <p>SOLUTION:<br> Use a css style to hide the button!</p> <p>Or you use a css file and link it to the control or you can set the style property of the control.</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>ahmed_fci2006</h4> 2-when make it visible it opens fileupload path but&nbsp; &quot;image path doesn't appear in file upload txt&quot;.</blockquote> <p></p> <p>&nbsp;</p> <p>Not sure what is causing this ...</p> <p>Did you use my code as is?? Make sure all controls are runat=&quot;server&quot;.</p> <p>If it is not working ... is there an error occuring? Maybe a javascript error (--&gt; yellow triangle in the bottom-left of browser)</p> <p>&nbsp;</p> <p>Kind regards,<br> Wim</p> 2007-09-23T13:37:33-04:002012146http://forums.asp.net/p/1121953/2012146.aspx/1?Re+How+to+change+Text+in+FileUpload+controlRe: How to change Text in FileUpload control <p class="MsoNormal" dir="ltr" style="margin:0cm 0cm 10pt; direction:ltr; unicode-bidi:embed; text-align:left"> <font face="Calibri" size="3">Hi,</font></p> <p class="MsoNormal" dir="ltr" style="margin:0cm 0cm 10pt; direction:ltr; unicode-bidi:embed; text-align:left"> <font face="Calibri" size="3">I'm user your trick in a UC and publish it in website, now when I press submit button , page don't submit and focus move to first filled fileupload<span style="">&nbsp; </span>if I remove<span style="">&nbsp; </span>&quot;visibility:hidden&quot; filupload! Other wise (I set visibility to hidden) submit button don't work while all of hidden fileupload become empty.</font></p> <p class="MsoNormal" dir="ltr" style="margin:0cm 0cm 10pt; direction:ltr; unicode-bidi:embed; text-align:left"> <font face="Calibri" size="3">Any one can help me?</font></p> <p class="MsoNormal" dir="ltr" style="margin:0cm 0cm 10pt; direction:ltr; unicode-bidi:embed; text-align:left"> <font face="Calibri" size="3">Thanks for your reply!</font></p> 2007-11-17T10:26:28-05:00