This is a migrated thread and some comments may be shown as answers.

cant bind linq to listbox

2 Answers 73 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Teoman
Top achievements
Rank 1
Teoman asked on 14 Jan 2010, 12:34 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Genady Sergeev
Telerik team
answered on 15 Jan 2010, 10:41 AM
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.
0
Teoman
Top achievements
Rank 1
answered on 15 Jan 2010, 02:17 PM
thank you.
Tags
ListBox
Asked by
Teoman
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Teoman
Top achievements
Rank 1
Share this question
or