InsertItemTemplate

Discussion in 'ASP .Net Datagrid Control' started by bgallagher, Dec 14, 2005.

  1. bgallagher

    bgallagher Guest

    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
    bgallagher, Dec 14, 2005
    #1
    1. Advertising

  2. bgallagher

    Elton Wang Guest

    In template:

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

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

    HTH


    "bgallagher" <> wrote in message
    news:ujUnf.57939$...
    > 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, Dec 14, 2005
    #2
    1. Advertising

  3. bgallagher

    bgallagher Guest

    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!

    "Elton Wang" <> wrote in message
    news:e$...
    > In template:
    >
    > <ItemTemplate><input type="file" id="uploadFile"
    > runat="server"></ItemTemplate>
    >
    > in code:
    > HtmlInputFile File = e.Item.FindControl("uploadFile") as HtmlInputFile;
    >
    > HTH
    >
    >
    > "bgallagher" <> wrote in message
    > news:ujUnf.57939$...
    >> 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
    >>

    >
    >
    bgallagher, Dec 15, 2005
    #3
  4. bgallagher

    Elton Wang Guest

    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





    "bgallagher" <> wrote in message
    news:%aiof.84269$...
    > 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!
    >
    > "Elton Wang" <> wrote in message
    > news:e$...
    >> In template:
    >>
    >> <ItemTemplate><input type="file" id="uploadFile"
    >> runat="server"></ItemTemplate>
    >>
    >> in code:
    >> HtmlInputFile File = e.Item.FindControl("uploadFile") as HtmlInputFile;
    >>
    >> HTH
    >>
    >>
    >> "bgallagher" <> wrote in message
    >> news:ujUnf.57939$...
    >>> 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, Dec 18, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. pjbates
    Replies:
    1
    Views:
    4,530
    Dan Vogt
    May 2, 2006
  2. Swetha
    Replies:
    0
    Views:
    3,692
    Swetha
    Nov 14, 2005
  3. jobs at webdos
    Replies:
    0
    Views:
    696
    jobs at webdos
    Oct 9, 2006
  4. Replies:
    1
    Views:
    863
    Mufasa
    May 19, 2008
  5. Cas
    Replies:
    0
    Views:
    794
Loading...

Share This Page