We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Data Source for List Box

Thread ID:

Created:

Updated:

Platform:

Replies:

108645 May 5,2013 11:03 AM May 7,2013 12:23 AM Orubase 1
loading
Tags: Orubase
Yara
Asked On May 5, 2013 11:03 AM

Im working on asp.net mvc , I have a viewmodel that return array of strings  from controller and I want to bind this array with LISTBOX control in view page
I return to the following site 
and go to listbox control I did't find any member that related to data source
so, can you help me please

Thivya [Syncfusion]
Replied On May 7, 2013 12:23 AM

Hi Yara,

Please find the below code snippets to bind the array of string as datasource to the Listbox control.

[Controller]

public ActionResult Demo()
{
List<string> data = new List<string>() { "Item1", "Item2", "Item3" };
return View(data); // passing data source to the listbox
}

[View]

@model
IEnumerable<string>

@Html.Orubase().ListBox("Incidents").RenderMode(RenderMode.Auto).IOS(c => c.ShowCorners(false)).BindDataSource(Model, map =>
{
map.MapTo<string>(binding =>
{
binding.ItemDataBound((item, nd) =>
{
item.Text = nd;
});
});
})

Also we have created sample and attached in the below link for further reference.

ListBoxDataSource.zip

Please try this and let us know if it helps.

Regards,
Thivya.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;