Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > DetailsView EditItemTemplate CheckBoxList2 bound and Related to CheckBoxList1

Thread Tools

DetailsView EditItemTemplate CheckBoxList2 bound and Related to CheckBoxList1

Posts: n/a
Hi all.
Patience is a virtue!! Please read on!
I have a DetailsView that is bound to an ObjectDataSource (ods) whose
selectparameter is set when a row in a GridView is selected. Works fine. I
see the record in the DetailsView. In the DetailsView i have a
templatefield named SystemCode with a DropDownList(ddlSystemCode) thats
bound to an ods (odsSystemCodes) and SelectedValue='Bind("SystemCode").
Works fine. I have another template field named TrainCode as a
CheckBoxList(cblTrainCode) that is bound to an ods (odsTrainCodes) and whose
SelectedValue='Bind("TrainCode"). When the user presses the Update Command
link, everything works fine. The ddlSystemCodes selected value is the one in
the database record. The TrainCodes CheckBoxList shows the correct checkbox
checked for the TrainCode in the database.

Now, in Edit Mode, if i select a different SystemCode from ddlSystemCode,
what i want to have happen is to have the TrainCode CheckBoxList show the
list of TrainCodes corresponding to the selected SystemCode. I'm trying to
do this by putting code in the ddlSystemCode's SelectedIndexChanged event to
change the SystemCode Select Parameter of the TrainCode ods (odsTrainCode).
When i do this i get this error:
"DataBinding methods such as Eval(), XPath() and Bind() can only be used in
the context of a databound control".
Is it because of the SelectedValue='<%#Bind("Traincode")%>' in cblTrainCode
Any ideas, workarounds or better approaches would be greatly appreciated!

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to access control in edititemtemplate of detailsview? (ASP 2.0 =?Utf-8?B?RnJpdHMgdmFuIFNvbGR0?= ASP .Net 5 07-19-2006 07:50 PM
DetailsView using Calendar Control in EditItemTemplate K B ASP .Net 0 04-20-2006 03:22 AM
DetailsView - EditItemTemplate - field validator??? K B ASP .Net 0 04-18-2006 10:10 PM
DetailsView EditItemTemplate DropdownList Update Problem Trevor Bezotte ASP .Net Datagrid Control 9 12-08-2005 01:12 AM
how do i access a dropdownlists selected value in a datagrid edititemtemplate column from the selectedindexchanged event of another dropdownlist in a datagrid edititemtemplate column Dave M ASP .Net Datagrid Control 0 12-14-2004 11:53 AM