Formview and external data

Discussion in 'ASP .Net' started by Wayne, Aug 2, 2007.

  1. Wayne

    Wayne Guest

    I am having trouble figuring out how to include Hidden Field or a TextBox
    value when I am editing in the FormView Edit Item Template into the Update
    Query. They are both located in the EditItemTemplate of the Formview. The
    value is grabbed using a function

    <asp:TextBox ID="LastUpdatedDate" runat="server" Text='<%# GetDateAndTime
    '></asp:TextBox><br />

    Public Function GetDateAndTime() As Date
    Return Now()
    End Function

    I also have in the page

    <asp:parameter Name="LastUpdatedDate" Type="DateTime" />

    And the Update Query includes

    [LastUpdatedDate] = @LastUpdatedDate

    But the LastUpdated Field becomes NULL

    If I could figure out how to do that, it would solve alot of problems. Ive
    tried to do this about 3 times without any luck

    In an attempt to find a work around I was going to grab the ITEM_ID Number,
    using Response.Form

    Response.Write("ID Number = " & Request.Form("ITEM_ID"))

    Then reinsert Now() as LastUpdatedDate

    How can you address values that are posted back using the Formview object

    Thanks for your help.

    Wayne
    Wayne, Aug 2, 2007
    #1
    1. Advertising

  2. Wayne

    Enigma Boy Guest

    Thats because you are not doing a two way databind.

    In the datasource updating event do a formview.findcontrol on the text box.
    and pass the value to e.NewValues

    --
    <a href="http://1pakistangifts.com">Send Gifts to Pakisan at #Pakistan Gifts
    Store</a> | <a href="http://dotspecialists.com">Leading Software offshoring
    and outsourcing service provider</a> | <a
    href="http://websitedesignersrus.com">Professional Websites at affordable
    prices</a>
    "Wayne" <> wrote in message
    news:newscache$hgx5mj$syk$...
    >I am having trouble figuring out how to include Hidden Field or a TextBox
    >value when I am editing in the FormView Edit Item Template into the Update
    >Query. They are both located in the EditItemTemplate of the Formview. The
    >value is grabbed using a function
    >
    > <asp:TextBox ID="LastUpdatedDate" runat="server" Text='<%# GetDateAndTime
    > '></asp:TextBox><br />
    >
    > Public Function GetDateAndTime() As Date
    > Return Now()
    > End Function
    >
    > I also have in the page
    >
    > <asp:parameter Name="LastUpdatedDate" Type="DateTime" />
    >
    > And the Update Query includes
    >
    > [LastUpdatedDate] = @LastUpdatedDate
    >
    > But the LastUpdated Field becomes NULL
    >
    > If I could figure out how to do that, it would solve alot of problems. Ive
    > tried to do this about 3 times without any luck
    >
    > In an attempt to find a work around I was going to grab the ITEM_ID
    > Number, using Response.Form
    >
    > Response.Write("ID Number = " & Request.Form("ITEM_ID"))
    >
    > Then reinsert Now() as LastUpdatedDate
    >
    > How can you address values that are posted back using the Formview object
    >
    > Thanks for your help.
    >
    > Wayne
    >
    >
    Enigma Boy, Aug 6, 2007
    #2
    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. Neo Geshel
    Replies:
    2
    Views:
    713
    Neo Geshel
    Nov 17, 2005
  2. Scott Allen
    Replies:
    8
    Views:
    10,889
    Scott Allen
    May 2, 2004
  3. Chris

    Formview within Formview

    Chris, May 19, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    496
    Chris
    May 19, 2007
  4. David Thielen

    FormView/Repeater/ Eval(FormView data)

    David Thielen, Jun 16, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    614
    David Thielen
    Jun 16, 2006
  5. Mellow Crow
    Replies:
    6
    Views:
    404
    Richard Cornford
    Nov 4, 2005
Loading...

Share This Page