0

I am creating list using linq in c# as following way and it works fine.

lst = (from n in dbEntity.Popup_Notes
       select n).ToList();

Now, I want to use this list from client side as array of objects. When user clicks on links, it will display specific notes descriptions as per name selection.

EDIT

i want something like this..

enter image description here

11
  • Is this a webform or MVC application? Commented Apr 5, 2013 at 5:41
  • webforms, a simple asp.net form with c#(4.0) Commented Apr 5, 2013 at 5:42
  • 1
    why do you need the list on the client side? Because of the client side/server side boundary, i would try to create a web api to return jason object of the list... Commented Apr 5, 2013 at 5:42
  • @will: if any possible solutions are also appreciated Commented Apr 5, 2013 at 5:44
  • I just need a little more info... can you explain why you need the list on the client side? Commented Apr 5, 2013 at 5:45

2 Answers 2

1

I think you need convert your list to JSON and return to client-side. At client, you can use knockout.js to bind data to your control, this way is easier than binding manually.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your quick reply. can you post some example code or reference links ?
The following code demo how to use knockout.js and bind data: var dataModel; function view(data) { var self = this; this.DescriptionA = ko.observable(data.descriptionA); this.DescriptionB = ko.observable(data.descriptionB); } $(function(){ dataModel = new view({"descriptionA": "Test A", "descriptionB": "Test B"}); ko.applyBindings(dataModel); }); As you see I bind data when I initialize View object. This is the demo: jsFiddle
0

Take a look at JSON.NET

Serialize your object(s) to JSON to pass it to your JavaScript code.

In your javascript code use jQuery.parseJson to parse JSON text and build javascript object(s) according to the received JSON text.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.