0

I am facing some abnormal behavior in my MVC application. I have taken textbox and label in my View

@Html.LabelFor(m => m.AddressLine1)
@Html.TextBoxFor(m => m.AddressLine1, new { maxlength = 40, title = "Enter Address Line1" })

and in my ViewModel

[DisplayName("Address Line1")]
[Required(ErrorMessage = "Please enter Address Line1")]
public string AddressLine1 { get; set; }

at the time of debugging when I am clicking on label, textbox is getting selected. Someone please help me to solve and please tell me why I am facing such kind of problem.

4

1 回答 1

0

这是标签的标准行为:

标签定义元素的<label>标签。

<label>元素不会为用户呈现任何特殊的东西。但是,它为鼠标用户提供了可用性改进,因为如果用户单击<label>元素内的文本,它会切换控件。

于 2013-10-17T12:12:55.100 回答