Groups | Blog | Home
all groups > asp.net datagrid control > december 2005 >

asp.net datagrid control : InsertItemTemplate


bgallagher
12/14/2005 12:34:34 PM
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

Elton Wang
12/14/2005 1:42:51 PM
In template:

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

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

HTH


[quoted text, click to view]

bgallagher
12/15/2005 6:00:27 PM
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!

[quoted text, click to view]

Elton Wang
12/18/2005 1:01:07 PM
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





[quoted text, click to view]

AddThis Social Bookmark Button