文本框的两个文本属性 [英] two text properties for a text boxes

查看:96
本文介绍了文本框的两个文本属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<asp:TemplateField HeaderText="ChallanDate"

                       SortExpression="ChallanDate">
                       <ItemTemplate>
                           <asp:TextBox ID="txtChallanDate" runat="server"



                               Text='<%# Bind("ChallanDate") %>'

                               Text='<%#  System.DateTime.Now.ToString(); %>'

                               ReadOnly="False" ForeColor="Blue"

                               BorderStyle="none" BorderWidth="0px">
                           </asp:TextBox>
                       </ItemTemplate>
                   </asp:TemplateField>



我想在单个文本框中使用两次文本属性,即绑定以及显示当前日期和时间但是当我应用上面的代码然后它显示我错误。


I want to use two times the property of text in a single textbox i.e. for Binding as well as showing be the present date and time but when I am applying the above code then It is showing me error.

推荐答案

你不能使用两次相同的属性。尝试将这两者结合起来

you can't use use the same property two times. try to combine those two
Text='<%# String.Format("{0} - {1}", Eval("ChallanDate"), System.DateTime.Now.ToString()) %>'


1.您不能再使用任何属性!



2.您的问题的解决方案是设置默认值您的数据(进入您的代码),然后将它们绑定到UI控件,并继续使用此文本字段的数据绑定。
1.You cannot use any property more then ones!

2.The solution for your problem is to set the default value in your data (into your code behind), before to bind them to the UI control, and to keep using data bind for this text field.


这篇关于文本框的两个文本属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆