Databinding error during autopostback of radiobuttonlist

Discussion in 'ASP .Net Web Controls' started by T.Stanley, Jun 5, 2006.

  1. T.Stanley

    T.Stanley Guest

    Hello.

    I have a page containing a radiobuttonlist that is bound to a sqldatasource
    providing a "master" list of data keys and descriptors. A second
    sqldatasource on the page queries the database for "detail" data, using the
    selectedvalue field of the radiobuttonlist as a parameter value. Then I have
    formviews that are bound to the output of the second sqldatasource.

    This works great and shows the detail data from the key of the FIRST
    selection of the radiobuttonlist. It doesn't matter if the selectedvalue is
    set by a statement in the Page_Load code, or, if no default selectedvalue has
    been initially programmed, at the time that the control is clicked on the
    page, causing a selection, autopostback, and FIRST time binding of the detail
    sqldatasource.

    The problem occurs when I click on the radiobuttonlist control to CHANGE the
    selected item from one previously bound. In this case, when the page posts
    back, I get an InvalidOperationException error with the descriptor
    "Databinding methods such as Eval(), XPath(), and Bind() can only be used in
    the context of a databound control."

    The problem is clearly in the fact that the detail sqldatasource uses the
    selectedvalue of the radiobuttonlist as its query selection parameter,
    because if I use a different source for the parameter, this error does not
    occur. Of course, then the page does not function as I want it to.

    Any ideas would be much appreciated. Thank you.
     
    T.Stanley, Jun 5, 2006
    #1
    1. Advertising

  2. T.Stanley

    ganniss Guest

    Hi TStanley

    You might be able to set up an intermediate hidden textbox and set it
    in the onclick or similar event of the radio button and use the
    intermediate hidden textbox as the parameter for the SQL datasource.
    Hope thats useful.

    Regards

    Gary Anniss (Anniss Commercial Systems) (UK) 07774 773341

    DEVELOPERS OF THE SQL SERVER 2005 VISUAL STUDIO 2005 UNFINANCE STATE OF
    THE ART FINANCIAL AND MANAGEMENT ACCOUNTING SYSTEM

    T.Stanley wrote:
    > Hello.
    >
    > I have a page containing a radiobuttonlist that is bound to a sqldatasource
    > providing a "master" list of data keys and descriptors. A second
    > sqldatasource on the page queries the database for "detail" data, using the
    > selectedvalue field of the radiobuttonlist as a parameter value. Then I have
    > formviews that are bound to the output of the second sqldatasource.
    >
    > This works great and shows the detail data from the key of the FIRST
    > selection of the radiobuttonlist. It doesn't matter if the selectedvalue is
    > set by a statement in the Page_Load code, or, if no default selectedvalue has
    > been initially programmed, at the time that the control is clicked on the
    > page, causing a selection, autopostback, and FIRST time binding of the detail
    > sqldatasource.
    >
    > The problem occurs when I click on the radiobuttonlist control to CHANGE the
    > selected item from one previously bound. In this case, when the page posts
    > back, I get an InvalidOperationException error with the descriptor
    > "Databinding methods such as Eval(), XPath(), and Bind() can only be used in
    > the context of a databound control."
    >
    > The problem is clearly in the fact that the detail sqldatasource uses the
    > selectedvalue of the radiobuttonlist as its query selection parameter,
    > because if I use a different source for the parameter, this error does not
    > occur. Of course, then the page does not function as I want it to.
    >
    > Any ideas would be much appreciated. Thank you.
     
    ganniss, Jun 19, 2006
    #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. Arun K
    Replies:
    0
    Views:
    547
    Arun K
    Dec 29, 2003
  2. CDARS
    Replies:
    0
    Views:
    569
    CDARS
    Jul 20, 2004
  3. Nevyn Twyll

    Custom RadioButtonList Databinding

    Nevyn Twyll, Mar 22, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    2,081
    Nevyn Twyll
    Mar 22, 2005
  4. Replies:
    1
    Views:
    480
    Nilesh Deshpande
    Nov 30, 2005
  5. Earl Teigrob
    Replies:
    1
    Views:
    409
    Shravan
    Mar 1, 2004
Loading...

Share This Page