I am trying to create a simple ajax grid that allows me to add and remove rows and also edit some of the columns and have others columns calculated directly based on the input in the others. I thought this would be a nice oppurtunity to play with asp.net ajax 4.0 and the client templates. It works pretty ok but I can't seem to find a way to bind my json data to a . How can I do this?
A normal template looks like this
<div id="authorsTemplate" style="visibility:hidden;display:none;">
<ul>
<li>First Name: {{ FirstName }}</li>
<li>Last Name: {{LastName}}</li>
<li>Url: <a href="{{Url}}">{{Url}}</a></li>
</ul>
</div>
How would I use the data bind syntax with a dropdown
<select id="">
<option value="1">1</option>
<option value="2">2</option>
</select>
EDIT: If the select tag had a value attribute the obvious solution would be. Edit2: The syntax below was actually the solution, Thx Roatin, I had no idea the select actually had a value attribute.
<select id="" value="{binding nr}">
<option value="1">1</option>
<option value="2">2</option>
</select>
I could maybe use custom javascript to set the selected option but the point is a live binding to my json object the same way you bind to the value of a input tag