473,761 Members | 3,651 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Resetting the value of a System.Web.UI.H tmlControls.Htm lInputFile

I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to
submit files. After the file is successfully submitted, I want the field to
be reset so that the user knows the file was submitted. However, ASP.NET
does not let you change the Value property of an HtmlInputFile control. How
can I reset the HtmlInputFile control to it's original state? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/
May 21 '06 #1
8 1866
Nathan,

A HTML control is not an ASPNET control. If it had extentions to handle it
in a better way, than it would be an ASPNET control.

Therefore handling an HTML control is as it could be done forever in HTML.
In my opinion is than the way to search for it on Google, but than not in
relation to DotNet but just as HTML control.

Cor

"Nathan Sokalski" <nj********@hot mail.com> schreef in bericht
news:eK******** ******@TK2MSFTN GP04.phx.gbl...
I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to
submit files. After the file is successfully submitted, I want the field to
be reset so that the user knows the file was submitted. However, ASP.NET
does not let you change the Value property of an HtmlInputFile control. How
can I reset the HtmlInputFile control to it's original state? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

May 22 '06 #2
Hi,
What you mean by reseting ?? is it means that you need to clear the value
from the control after the postback ??
--
Deepson Thomas
"Nathan Sokalski" wrote:
I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to
submit files. After the file is successfully submitted, I want the field to
be reset so that the user knows the file was submitted. However, ASP.NET
does not let you change the Value property of an HtmlInputFile control. How
can I reset the HtmlInputFile control to it's original state? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

May 22 '06 #3
I think that there is an important lesson you should learn about how ASP.NET
handles controls. Any time you add runat="server" and an ID attribute to a
control, whether it is an html control or an ASP.NET webcontrol or any other
kind of control, if it is declared ASP.NET will treat it as an object (not
necessarily with extensions, it might just be an HtmlGenericCont rol). But
ASP.NET does have a class for the input type="file" control, which is
System.Web.UI.H tmlControls.Htm lInputFile One of the properties of this
control is Value. The Value property is not labeled as ReadOnly, but when
ASP.NET runs into the code where I assign a value to it while my Application
is running, it gives me an error saying I cannot change the Value property.
If I remember correctly, the same thing happens in JavaScript (although it's
been a while since I tried that). I may not have explained every detail with
textbook clarity here, but the important thing is that from ASP.NET's view
in my code, it is an ASP.NET control.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Nathan,

A HTML control is not an ASPNET control. If it had extentions to handle it
in a better way, than it would be an ASPNET control.

Therefore handling an HTML control is as it could be done forever in HTML.
In my opinion is than the way to search for it on Google, but than not in
relation to DotNet but just as HTML control.

Cor

"Nathan Sokalski" <nj********@hot mail.com> schreef in bericht
news:eK******** ******@TK2MSFTN GP04.phx.gbl...
I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to
submit files. After the file is successfully submitted, I want the field
to be reset so that the user knows the file was submitted. However,
ASP.NET does not let you change the Value property of an HtmlInputFile
control. How can I reset the HtmlInputFile control to it's original state?
Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/


May 22 '06 #4
Yes, if the control continues to display the file path after I upload it,
many users will be inclined to think the upload was unsuccessful (even
though they will be able to see it in a list on the page). But I also want
it to be cleared so that the validator control I use to check that they
selected a file is useful.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Deepson Thomas" <De***********@ discussions.mic rosoft.com> wrote in message
news:AB******** *************** ***********@mic rosoft.com...
Hi,
What you mean by reseting ?? is it means that you need to clear the value
from the control after the postback ??
--
Deepson Thomas
"Nathan Sokalski" wrote:
I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to
submit files. After the file is successfully submitted, I want the field
to
be reset so that the user knows the file was submitted. However, ASP.NET
does not let you change the Value property of an HtmlInputFile control.
How
can I reset the HtmlInputFile control to it's original state? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

May 22 '06 #5
I am also having difficultly with the htmlinput file control I have a script
to validate the entry if the validation fails I need to return to the form
with htmlinputfile value still selected in the input box. The validation is
actually failing because of the file description that is entered into another
field on the form.

I AM SORRY COR to post in this thread but MS does use the HTMLINPUTFILE in
documentation and I have not had luck in GOOGLE.

Do you think you could tell us where to post this question instead of here?
--
cindy
"Cor Ligthert [MVP]" wrote:
Nathan,

A HTML control is not an ASPNET control. If it had extentions to handle it
in a better way, than it would be an ASPNET control.

Therefore handling an HTML control is as it could be done forever in HTML.
In my opinion is than the way to search for it on Google, but than not in
relation to DotNet but just as HTML control.

Cor

"Nathan Sokalski" <nj********@hot mail.com> schreef in bericht
news:eK******** ******@TK2MSFTN GP04.phx.gbl...
I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to
submit files. After the file is successfully submitted, I want the field to
be reset so that the user knows the file was submitted. However, ASP.NET
does not let you change the Value property of an HtmlInputFile control. How
can I reset the HtmlInputFile control to it's original state? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/


May 23 '06 #6
Haven't thoroughly looked at your code, but you may probably want to do the
following:

object SaveViewState()
{
object[] data = new object[2];
data[0] = base.SaveViewSt ate();
date[1] = hash;

return data;
}

LoadViewState(o bject obj)
{
if(obj != null && obj is object[])
{
object[] data = (object[]) obj;
base.LoadViewSt ate(data[0]);
Hashtable hash = (Hashtable) data[1];
<<Populate from the hash>>
}
}

--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
-------------------
"cindy" <cm****@nospam. nospam> wrote in message
news:F7******** *************** ***********@mic rosoft.com...
I am also having difficultly with the htmlinput file control I have a
script
to validate the entry if the validation fails I need to return to the form
with htmlinputfile value still selected in the input box. The validation
is
actually failing because of the file description that is entered into
another
field on the form.

I AM SORRY COR to post in this thread but MS does use the HTMLINPUTFILE in
documentation and I have not had luck in GOOGLE.

Do you think you could tell us where to post this question instead of
here?
--
cindy
"Cor Ligthert [MVP]" wrote:
Nathan,

A HTML control is not an ASPNET control. If it had extentions to handle
it
in a better way, than it would be an ASPNET control.

Therefore handling an HTML control is as it could be done forever in
HTML.
In my opinion is than the way to search for it on Google, but than not in
relation to DotNet but just as HTML control.

Cor

"Nathan Sokalski" <nj********@hot mail.com> schreef in bericht
news:eK******** ******@TK2MSFTN GP04.phx.gbl...
>I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to
>submit files. After the file is successfully submitted, I want the field
>to
>be reset so that the user knows the file was submitted. However, ASP.NET
>does not let you change the Value property of an HtmlInputFile control.
>How
>can I reset the HtmlInputFile control to it's original state? Thanks.
> --
> Nathan Sokalski
> nj********@hotm ail.com
> http://www.nathansokalski.com/
>


May 23 '06 #7
Cindy,

This is for me always the first start to problems with HTML controls. And
this special with the input file one.

http://msdn.microsoft.com/library/de...input_file.asp

This can be handled with javascript.

In VB.Net the javascript can be used with register....... ... Be aware that
this have different implementations in version 1.x and 2.0

Cor
"cindy" <cm****@nospam. nospam> schreef in bericht
news:F7******** *************** ***********@mic rosoft.com...
I am also having difficultly with the htmlinput file control I have a
script
to validate the entry if the validation fails I need to return to the form
with htmlinputfile value still selected in the input box. The validation
is
actually failing because of the file description that is entered into
another
field on the form.

I AM SORRY COR to post in this thread but MS does use the HTMLINPUTFILE in
documentation and I have not had luck in GOOGLE.

Do you think you could tell us where to post this question instead of
here?
--
cindy
"Cor Ligthert [MVP]" wrote:
Nathan,

A HTML control is not an ASPNET control. If it had extentions to handle
it
in a better way, than it would be an ASPNET control.

Therefore handling an HTML control is as it could be done forever in
HTML.
In my opinion is than the way to search for it on Google, but than not in
relation to DotNet but just as HTML control.

Cor

"Nathan Sokalski" <nj********@hot mail.com> schreef in bericht
news:eK******** ******@TK2MSFTN GP04.phx.gbl...
>I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to
>submit files. After the file is successfully submitted, I want the field
>to
>be reset so that the user knows the file was submitted. However, ASP.NET
>does not let you change the Value property of an HtmlInputFile control.
>How
>can I reset the HtmlInputFile control to it's original state? Thanks.
> --
> Nathan Sokalski
> nj********@hotm ail.com
> http://www.nathansokalski.com/
>


May 23 '06 #8
I am new to c# I just want to inherit from htmlinputfile control and override
default LoadPostData always returns
false I want it to return true it is not security violation because the
Value property is readonly. The user then does not have to reselect the file
to try upload again. I have a System.Web.UI.H tmlControls.Htm lInputFile
control that I use to
submit files. Before the file is successfully submitted I validate another
field on the form, it is the description of the file must be 500 characters.
I am adding the file to a site server library programmaticall y so if the
field is too long I want to return the user to the form with file still
selected in the HtmlInputFile control. I am using an error label to inform
the user to shorten the description. I do not want the user to have to
browse again to the same file after he has shortened the description. Right
now the file does not upload but the control is empty. ASP.NET does not let
me programmaticall y put the full filename and path back into the Value
property of the HtmlInputFile control. How can I do this? I have version
asp.net 1.1 I found this but I don't know enough where to start
.............
these controls do not save their viewstate. LoadPostData always returns
false. You can inherit from the class and
override LoadPostData to return true and try to restore the value, and still
have value readonly.
I am new to c# and asp net controls. is there example to inherit from
HtmlInputFile class and override LoadPostData to
return true I am using C# and this is challenging me bad. cindy

--
cindy
"Cor Ligthert [MVP]" wrote:
Cindy,

This is for me always the first start to problems with HTML controls. And
this special with the input file one.

http://msdn.microsoft.com/library/de...input_file.asp

This can be handled with javascript.

In VB.Net the javascript can be used with register....... ... Be aware that
this have different implementations in version 1.x and 2.0

Cor
"cindy" <cm****@nospam. nospam> schreef in bericht
news:F7******** *************** ***********@mic rosoft.com...
I am also having difficultly with the htmlinput file control I have a
script
to validate the entry if the validation fails I need to return to the form
with htmlinputfile value still selected in the input box. The validation
is
actually failing because of the file description that is entered into
another
field on the form.

I AM SORRY COR to post in this thread but MS does use the HTMLINPUTFILE in
documentation and I have not had luck in GOOGLE.

Do you think you could tell us where to post this question instead of
here?
--
cindy
"Cor Ligthert [MVP]" wrote:
Nathan,

A HTML control is not an ASPNET control. If it had extentions to handle
it
in a better way, than it would be an ASPNET control.

Therefore handling an HTML control is as it could be done forever in
HTML.
In my opinion is than the way to search for it on Google, but than not in
relation to DotNet but just as HTML control.

Cor

"Nathan Sokalski" <nj********@hot mail.com> schreef in bericht
news:eK******** ******@TK2MSFTN GP04.phx.gbl...
>I have a System.Web.UI.H tmlControls.Htm lInputFile control that I use to
>submit files. After the file is successfully submitted, I want the field
>to
>be reset so that the user knows the file was submitted. However, ASP.NET
>does not let you change the Value property of an HtmlInputFile control.
>How
>can I reset the HtmlInputFile control to it's original state? Thanks.
> --
> Nathan Sokalski
> nj********@hotm ail.com
> http://www.nathansokalski.com/
>


May 23 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1172
by: szabelin | last post by:
Hello, all of a sudden my HtmlInputFile stopped working: UploadedFile.PostedFile is always null. It used to work before. Can anyone please suggest something? Thanks! &lt;input runat="server" ID="UploadedFile" type="file" size="35" /&gt; System.Web.UI.HtmlControls.HtmlInputFile UploadedFile;
12
2351
by: Mark Kurten | last post by:
i have the code below: for starters the value of txtempid = 1 after i go through this routine (i put a break point on the txtname.value line), the value of txtEmpID is 2 (Just like it is suppose to be) However, when i come into this function again, txtEmpID = 1 again For some reason the txtEmpID.value isn't retaining its actual value of 2 any ideas? Try
3
4557
by: Dave Adler | last post by:
Is there any way to retain the value of an HtmlInputFile control through a postback? I do some server side validation on the page when it is submitted and if an error occurs on the page the HtmlInputFile control value is blank after the postback. The EnableViewState for the control is set to true. I can't put the postedFile.filename value in a hidden control and then put it back into the HtmlInputFile control on postback because the...
2
2668
by: Sean Carey | last post by:
I converted a C# Upload app to VB.NET and am down to one error and was hoping someone could help me with te error. I would greatly appreciate help from anyone. Here is the error: c:\inetpub\wwwroot\admin\filemanager.aspx.vb(76): Expression is of type 'System.Web.UI.HtmlControls.HtmlInputFile', which is not a collection type.
2
3277
by: xenophon | last post by:
I added a Hidden Form Field to a form in the code behind. The value is being set in JavaScript client-side, but it is not persisting to the server in the PostBack. I know the value is being set properly because it displays in the document.write method. Create a simple page and paste the below in the code-behind (ASP.NET 1.1-SP1) using System;
8
4265
by: Nathan Sokalski | last post by:
I have a System.Web.UI.HtmlControls.HtmlInputFile control that I use to submit files. After the file is successfully submitted, I want the field to be reset so that the user knows the file was submitted. However, ASP.NET does not let you change the Value property of an HtmlInputFile control. How can I reset the HtmlInputFile control to it's original state? Thanks. -- Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/
7
1619
by: cindy | last post by:
I have a System.Web.UI.HtmlControls.HtmlInputFile control that I use to submit files. Before the file is successfully submitted I validate another field on the form, it is the description of the file must be 500 characters. I am adding the file to a site server library programmatically so if the field is too long I want to return the user to the form with file still selected in the HtmlInputFile control. I am using an error label to inform...
0
1177
by: gazza | last post by:
Hi, I have an application which shows a single record which has numerous image files stored. The images are displayed as thumbnails, and if I click on "Edit", an HtmlInputFile control is displayed next to each thumbnail allowing the user to change the image. Unfortunately, I have to have a separate normal asp.net button to firstly upload the selected image and also change the thumbnail. All of these controls are added dynamically at...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.