cant bind linq to listbox

3 posts, 1 answers
  1. Teoman
    Teoman avatar
    69 posts
    Member since:
    Jan 2009

    Posted 14 Jan 2010 Link to this post

    Hi,
    I am calling stored procedure with linq.i can bind radgird with these commands

    mmsDataContext mms = new mmsDataContext();
    RadGrid1.DataSource = mms.SP_WES_groupSelect(P1,P2);
    RadGrid1.DataBind();

    but i cant bind it with radlist.when i bind it show me "SP_WES_groupSelectResult" value in radlist.i am trying to bind like this.

    mmsDataContext mms = new mmsDataContext();
    RadListBox1.DataSource = mms.SP_WES_groupSelect(P1,P2);
    RadListBox1.DataBind();
  2. Answer
    Genady Sergeev
    Admin
    Genady Sergeev avatar
    1600 posts

    Posted 15 Jan 2010 Link to this post

    Hello Teoman,

    Along with the DataBind invocation, you will need to set the DataTextField and the DataValueField of your RadListBox. They should be names of columns in your business object. For example, suppose that the context returns a business object that is list of shippers from the northwind database. Then you will need to use the following code in order to show the obtained data in the RadListBox:

    RadListBox1.DataSource = *some data source*
    RadListBox1.DataValueField = "ShipperID";
    RadListBox1.DataTextField = "CompanyName";
    RadListBox1.DataBind();


    Kind regards,
    Genady Sergeev
    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.
  3. Teoman
    Teoman avatar
    69 posts
    Member since:
    Jan 2009

    Posted 15 Jan 2010 Link to this post

    thank you.
Back to Top