[英]Unable to find client side html date control from server side
Unable to find client side html date control from server side.无法从服务器端找到客户端 html 日期控件。
Following html code is for capturing date.以下 html 代码用于捕获日期。
<input type="date" class="form-control" id="dtpdob" runat="server" placeholder="Enter Date of Birth" name="dtpdob" />
Following code in server side for finding the control of client side.在服务器端跟踪代码以查找客户端的控制。
Dim btns As HtmlInputText = TryCast(Me.FindControl("dtpdob"), HtmlInputText)
If btns.Value = "" Then
lblErrorText.Text = "No data available"
End If
System is giving the following error in btns.Value系统在 btns.Value 中给出以下错误
System.NullReferenceException: 'Object reference not set to an instance of an object.'
System.NullReferenceException:“对象引用未设置为 object 的实例。” btns was Nothing.
btns 什么都不是。
Kindly help.请帮忙。
You can try the following:您可以尝试以下方法:
Dim btns As HtmlInputControl = DirectCast(Me.FindControl("dtpdob"), System.Web.UI.HtmlControls.HtmlInputControl)
If btns.Value = "" Then
lblErrorText.Text = "No data available"
End If
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.