I am creating a website using Twitter Bootstrap which includes typeahead for forms. I would like to populate the data source for my typeahead but when i use this method:
data-source="[@foreach (var row in TS){@row.Name};]"
I can't put the quotes around each value or the comma in between each value because it should be in the format:
data-source="["value1","value2"]"
My multimedia major project: http://www.surgestuff.com | Please mark me as answer if I helped
Thanks
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
Marked as answer by mhcodner on Dec 18, 2012 05:50 AM
mhcodner
Member
219 Points
86 Posts
Bootstrap typeahead problem
Dec 14, 2012 12:06 PM|LINK
I am creating a website using Twitter Bootstrap which includes typeahead for forms. I would like to populate the data source for my typeahead but when i use this method:
data-source="[@foreach (var row in TS){@row.Name};]"I can't put the quotes around each value or the comma in between each value because it should be in the format:
Abhishek Luv
Participant
1736 Points
468 Posts
Re: Bootstrap typeahead problem
Dec 16, 2012 03:57 AM|LINK
Dear
You can use a Json Array as a Data Source.
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
mhcodner
Member
219 Points
86 Posts
Re: Bootstrap typeahead problem
Dec 16, 2012 04:50 AM|LINK
Can you please point me towards a tutorial for that because i dont know how to?
GmGregori
Contributor
5446 Points
735 Posts
Re: Bootstrap typeahead problem
Dec 17, 2012 11:20 PM|LINK
Try placing in the code section of your page something like
List<string> list = new List<string>(); foreach (var row in TS) { list.Add(row.Name); } var JsonString = Json.Encode(list);and then populating your data source with