开发者

Textbox binding does not work ,when changes are made

开发者 https://www.devze.com 2023-02-06 23:22 出处:网络
Hoping I have an object (skuform),whose property(SKUCode) is bound to a textbox. If I run this form , change the value in the textbox (say \"test123\"), and hit the button, I notice that the object\'

Hoping I have an object (skuform),whose property(SKUCode) is bound to a textbox. If I run this form , change the value in the textbox (say "test123"), and hit the button, I notice that the object's (skuForm) property does not reflect the new value ("test123"), could you please suggest what could be wrong.

<td>
    <telerik:RadTextBox runat="server" ID="txtSKUCode"  
                   text='<%# skuForm.SKUCode %>' 
                   EnableViewState="true开发者_C百科"
                   Wrap="false" 
                   ontextchanged="txtSKUCode_TextChanged">
    </telerik:RadTextBox>
</td></tr> 

<telerik:RadButton ID="RadButton1" 
                   runat="server" 
                   onclick="RadButton1_Click">
</telerik:RadButton>


Try to set RadTextBox DataContext property to class wich implemented INotifyPropertyChanged interface. So when PropertyChanged event will occurs, you RadTextBox will change his value.

You can see sample of this on msdn page.


When do you call DataBind? If you're not calling it on the postback, then it won't get updated.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号