Problem: Usercontrol + Objectdatasource not updating parameters

Discussion in 'ASP .Net' started by timdelong1@yahoo.com, Sep 23, 2007.

  1. Guest

    I was writing a usercontrol in ASP.NET that contained an
    objectdatasource, a gridview, and some other form controls (textboxes
    and dropdown lists). For the insertcommand parameters I associated
    them with the form controls by assigning the ID of each control. The
    button event simply called the DataBind method on the Gridview.

    If I then typed values into the form fields and clicked the button,
    the insertparameter collection never updated itself based on the
    values I just entered.

    If I take this same code and paste it onto an aspx it works
    perfectly. Each button click correctly checks the controls and takes
    whatever value is present.

    Thinking I may have done something elsewhere that was causing the
    problem I created an entirely new project, recreated everything, used
    only one form control (a single textbox named TextBox1) and the exact
    same behavior was repeated.

    Any thoughts? I know I must be doing something incorrectly here, but
    I'm not sure what. When I was assigning a form control to the
    associated FormParameter I was just entering the control name (ex.
    TextBox1). The behavior displayed was almost like the datasource
    couldn't find the form field.

    Has anyone else encountered this problem, and if so, how did you fix
    it?
    , Sep 23, 2007
    #1
    1. Advertising

  2. Guest

    After a good nights sleep I realized my mistake. I should have been
    using ControlParameter instead of FormParameter. Changing that fixed
    the problem quite nicely.
    , Sep 24, 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. =?Utf-8?B?RGFiYmxlcg==?=

    FormView update not updating with ObjectDataSource

    =?Utf-8?B?RGFiYmxlcg==?=, Apr 13, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    9,295
    =?Utf-8?B?RGFiYmxlcg==?=
    Apr 13, 2006
  2. Dennis
    Replies:
    0
    Views:
    1,150
    Dennis
    Jul 1, 2006
  3. Replies:
    0
    Views:
    362
  4. news.rcn.com
    Replies:
    2
    Views:
    1,113
    Roedy Green
    Dec 10, 2007
  5. David Thielen

    ObjectDataSource method as another ObjectDataSource

    David Thielen, Mar 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    241
    Steven Cheng[MSFT]
    Mar 23, 2006
Loading...

Share This Page