Question

The following code should bind the "value" property of the text box to the string "Test".

Instead the binding expression "{{test}}" is left unparsed as the text box content. The binding expression within the sibling element is parsed correctly however.

<html>
<head>
    <title></title>
    <style type="text/css">
        .sys-template { display:none; }
    </style>
    <script type="text/javascript" src="http://ajax.microsoft.com/ajax/beta/0911/MicrosoftAjax.debug.js"></script>
    <script type="text/javascript" src="http://ajax.microsoft.com/ajax/beta/0911/MicrosoftAjaxTemplates.debug.js"></script>
</head>
<body xmlns:sys="javascript:Sys"
      xmlns:dataview="javascript:Sys.UI.DataView"
      sys:activate="bindingTest">
        <div id="bindingTest" class="sys-template"
            sys:attach="dataview"
            dataview:data="{{ { test : 'Test' } }}">
                <input type="text" value="{{test}}" />
                should contain: <span>{{test}}</span>
        </div>
</body>
</html>

This same code works when linking to the corresponding scripts in the ASP.NET AJAX Preview 4 release (no longer available on CodePlex as far as I can tell, but contained in the sample ZIP on this post).

Is this a regression, or am I missing something?

Was it helpful?

Solution

I discovered that qualifying the value attribute with the sys: namespace enables binding to work properly:

<input type="text" sys:value="{{test}}" />

This was a change made in ASP.NET AJAX 4.0 Preview 5: http://weblogs.asp.net/fredriknormen/archive/2009/09/11/asp-net-ajax-4-0-preview-5-available.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top