Implementing two way binding for non databound controls

2 posts, 0 answers
  1. Stephen Cossgrove
    Stephen Cossgrove avatar
    7 posts
    Member since:
    Nov 2009

    Posted 14 Dec 2009 Link to this post


    i am currently trying to bind a object property to a RadTextBox and am getting the following error when using the <%# Bind(DataItem.Name) %> method:
    System.InvalidOperationException: Databinding methods such as Eval(), XPath(),  
    and Bind() can only be used in the context of a databound control. 

    I can bind using the following, but it is only one way:
    %# DataBinder.Eval(this, "DataItem.Name") %> 

    How can i get two way binding?

  2. Pavlina
    Pavlina avatar
    6187 posts

    Posted 17 Dec 2009 Link to this post

    Hello Stephen,

    To perform two-way binding you could use this method:
    Text='<%# Bind("Name") %>'

    For more information, please refer to this help topic:
    Two-way declarative binding

    Kind regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top