InsertItemTemplate

B

bgallagher

Is there a way to reference the objects within this template? I need to
add a file upload object (which I can do) but then need to know how to
reference that from an event so that I can then upload the file.

Thanks in Advance
 
E

Elton Wang

In template:

<ItemTemplate><input type="file" id="uploadFile"
runat="server"></ItemTemplate>

in code:
HtmlInputFile File = e.Item.FindControl("uploadFile") as HtmlInputFile;

HTH
 
B

bgallagher

Excellent thanks for that!

Now another stupid question but how do I get that then to be included in the
insert query srting as I cant databind it?

Thanks in advance again!
 
E

Elton Wang

Use HtmlInputFileObj.PostedFile to get HttpPostedFile object. Then use
HttpPostedFile's members such as FileName, InputStream, SaveAs, and so on,
to perform your logic.



HTH
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top