Databinding error during autopostback of radiobuttonlist

T

T.Stanley

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.
 
G

ganniss

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top