Hi All,
I am trying to create a custom control that contains a HtmlInputFile web contol. I am having trouble accessing the control's properties on postback.
Let me clarify.
When I just use the HtmlInputFile on a page, in the server-side click event of a button I am able to access the HtmlInputFile properties just fine. But when I create the HtmlInputFile in a custom control, the HtmlInputFile control seems to be reset when CreateChildControls
is run BEFORE the click event is run.
Is there a way around this? Or is it just that the HtmlInputFile control is not meant to be a part of a custom control?
If this isn't clear, I'll try again.
Thanks for any help,
Steele.
In Custom control you get the HtmlInputFile class by implementing the IPostBackDataHandler interface. Try the links below for the two versions of the interface. Hope this helps.
Hi Though this is old post, since i am facing same problem i have replied to this thread.
As suggested i have implemented IPostBackDataHandler, but throught that i could only able to get the fullpath (along with the file name) of the posted file.
My doubt is how to get the complete posted file in the postback method.
I have tried HttpContext.current.request.files['mycontrl'];
None
0 Points
13 Posts
HtmlInputFile in a custom web control
Nov 09, 2005 11:55 PM|Crow-knee|LINK
I am trying to create a custom control that contains a HtmlInputFile web contol. I am having trouble accessing the control's properties on postback.
Let me clarify.
When I just use the HtmlInputFile on a page, in the server-side click event of a button I am able to access the HtmlInputFile properties just fine. But when I create the HtmlInputFile in a custom control, the HtmlInputFile control seems to be reset when CreateChildControls is run BEFORE the click event is run.
Is there a way around this? Or is it just that the HtmlInputFile control is not meant to be a part of a custom control?
If this isn't clear, I'll try again.
Thanks for any help,
Steele.
Contributor
4150 Points
5249 Posts
Re: HtmlInputFile in a custom web control
Nov 10, 2005 10:33 AM|Caddre|LINK
In Custom control you get the HtmlInputFile class by implementing the IPostBackDataHandler interface. Try the links below for the two versions of the interface. Hope this helps.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuiipostbackdatahandlerclasstopic.asp
http://msdn.microsoft.com/en-us/library/system.web.ui.ipostbackdatahandler.aspx
None
0 Points
1 Post
Re: HtmlInputFile in a custom web control
May 20, 2009 12:34 PM|carthi5000|LINK
Hi Though this is old post, since i am facing same problem i have replied to this thread.
As suggested i have implemented IPostBackDataHandler, but throught that i could only able to get the fullpath (along with the file name) of the posted file.
My doubt is how to get the complete posted file in the postback method.
I have tried HttpContext.current.request.files['mycontrl'];
but is not working out.
Please give me your suggestions.
.NET 3.5 .ASPX .net