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. Image for the cookie policy date

Child ListBox with anew model from controller

I'm work on asp.net mvc and work on syncfusion tool,

I can bind listbox with model that return from controller method , but I need the following

When I click in the listBox item, a method from controller will be called from javascript and a new model will be return to be viewed as a ChildListBox  to selected item

So, how can I do it with listbox control please

Thanks 


4 Replies

TH Thivya Syncfusion Team May 20, 2013 10:03 AM UTC

Hi Yara,

Thanks for your interest in Orubase product.

You can achieve your requirement by calling action, while clicking the list item using ‘OnItemSelect’ clientside event. Please refer the below code snippets.

//Script

function SendPost(sender, args) {
   $.mobile.changePage("/home/ListboxPost/" + args.Text.toLowerCase());
}

//Controller

public ActionResult ListboxPost(string id) // Which gets the parent items text
{
   products.Clear();
   var data = RenderChildDataSource(id); // Sending new model data for the child item
   return View(data);
}

We have also created sample for the same. Please refer the sample in the below attachment.

DemoApp.zip

Please try this and let us know if you have queries.

Regards,
Thivya.



YA Yara May 21, 2013 08:41 PM UTC

thank you very very much for your response
Example was clear and now I can display child list in a new view 
but I had a problem 
when I select item I can display the selected item in function in JavaScript by using alert , but when I pass it to method in controller the value of it been empty, I don't know why 
note: my items stored in list of string like
List<string> data = new List<string>(new string[size]);
so can you help me 

Yara




YA Yara May 22, 2013 03:22 AM UTC

thank you very much for all your support
my problem solved
Regards



TH Thivya Syncfusion Team May 22, 2013 06:08 AM UTC

Hi Yara,

Thanks for the update. We are glad the issue resolved.

Please let us know if you have any further queries.

Regards,
Thivya.

Loader.
Up arrow icon