详细信息视图只读字段 [英] Details view readonly field
问题描述
我有一张有关员工详细信息的表.
我有几列,包括带有用户名的个人详细信息.
我希望员工仅编辑个人信息,而不编辑用户名.
我为此使用了详细信息视图,并将用户名设为READONLY字段.
但是我的问题是在单击更新后编辑了字段之后,READONLY用户名字段为NULL值.为什么会这样呢?如何防止用户名采用NULL值并保持原样?
我无法理解问题所在.
I have a table for employee details.
I have several columns including personal details with username.
I want employees to edit only personal info and not the username.
I have used details view for that and make username READONLY field.
But my problem is after editing the fields when I click update, the READONLY username field takes NULL value. Why is it so? What can I do to prevent the username taking the NULL value and remain as it is?
I am not able to understand what the problem is.
推荐答案
protected void Page_Load(object sender, EventArgs e)
{
txtStartDate.Attributes.Add("readonly","readonly");
}
如果现在在后面的代码中像这样设置ReadOnly属性,那么我们就有机会从该只读控件中获取数据,而不会给用户提供在文本框中输入数据的机会.有关更多信息,请参见
点击
If set ReadOnly property like this in code behind now we have a chance to get the data from that read only control without giving chance to user to enter data in textbox. For more you can see this
Click
这篇关于详细信息视图只读字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!