如何避免在用于日历扩展器的文本框中进行操作 [英] how to avoid manipulation in textbox used for calendar extender
本文介绍了如何避免在用于日历扩展器的文本框中进行操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
In my project I use TextBox2 for receiving date through Calender Extender of ajax.
After date selected in Calender extender the date is displayed in TB2 but allows one to alter it.
I dont want the TB2 to be altered. How to do it. In my code I used 'Readonly=true' but it is not allowing to select the date from Calender Extender. Hereunder is my code.
<asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True" ReadOnly="true"
OnTextChanged="TextBox2_TextChanged" Font-Size="Medium"
style="z-index: 1; left: 930px; top: 148px; position: absolute;height: 20px; width: 100px"></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender1" runat="server"
TargetControlID="TextBox2"
Format="dd/MM/yyyy">
</asp:CalendarExtender>
谢谢。
Thanks.
推荐答案
在页面加载中,我使用了:
TextBox1.Attributes.Add(readonly,readonly);
它适用于我。
感谢Rajneesh Verma博客。
In page load, I used :
TextBox1.Attributes.Add("readonly", "readonly");
It worked for me.
Thanks to Rajneesh Verma blog.
这篇关于如何避免在用于日历扩展器的文本框中进行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文