Programmatically using and adding htmlcontrols

C

Chris Kennedy

I have a composite control which dynamically adds controls depending on how
it is intialised from an XML file. This all works well with web controls. I
want to be able to add an htmlinputfile server control. This best I got so
far is a literal e.g.

fileid = "<input type='submit' id='submit1'
onserverclick='SubmitButton_Click'>"
Controls.Add(New LiteralControl(fileid ))

It triggers its event but when I use the httpFileCollection in that event,
there are no files in there and the count reads 0. Can anyone help? The
enctype is right. My main theories are that this control is nested within a
form on the parent page but is being interpreted as a standard html input
rather than a server on as it inserted after the creation of the parent
page. Can anyone point me in the right direction of dynamically adding HTML
server control
 
S

Scott Mitchell [MVP]

Chris said:
I have a composite control which dynamically adds controls depending on how
it is intialised from an XML file. This all works well with web controls. I
want to be able to add an htmlinputfile server control. This best I got so
far is a literal e.g.

fileid = "<input type='submit' id='submit1'
onserverclick='SubmitButton_Click'>"
Controls.Add(New LiteralControl(fileid ))

Chris, you want to add an actual HtmlInputFile class instance.

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
C

Chris Kennedy

I sort got there on my own!! I figured out that you add a placeholder web
control which you can then add instances of the htmlinputfile control. Works
great.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top