DetailsView EditItemTemplate CheckBoxList2 bound and Related to CheckBoxList1

Discussion in 'ASP .Net Web Controls' started by MikeR, Aug 25, 2006.

  1. MikeR

    MikeR Guest

    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!
     
    MikeR, Aug 25, 2006
    #1
    1. Advertisements

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?RnJpdHMgdmFuIFNvbGR0?=

    How to access control in edititemtemplate of detailsview? (ASP 2.0

    =?Utf-8?B?RnJpdHMgdmFuIFNvbGR0?=, Nov 22, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    29,425
    ashishbuddha
    Jul 19, 2006
  2. sunil panda

    Lower bound & Upper bound

    sunil panda, Dec 25, 2003, in forum: Java
    Replies:
    9
    Views:
    7,876
    thushara wijeratna
    Oct 7, 2008
  3. K B
    Replies:
    0
    Views:
    2,126
  4. K B
    Replies:
    0
    Views:
    3,747
  5. Rhiner Dan
    Replies:
    1
    Views:
    980
    Mike Wahler
    Mar 27, 2005
  6. Mario Krsnic
    Replies:
    0
    Views:
    569
    Mario Krsnic
    Jun 23, 2006
  7. Phillip Vong
    Replies:
    0
    Views:
    546
    Phillip Vong
    Jul 27, 2006
  8. Trevor Bezotte

    DetailsView EditItemTemplate DropdownList Update Problem

    Trevor Bezotte, Dec 1, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    9
    Views:
    552
    Steven Cheng[MSFT]
    Dec 8, 2005
Loading...