我正在尝试将两个变量设置为两个各自的控件,而我当前的代码不起作用。什么是正确的语法?
ascx代码:
<ul>
<li runat="server" id="searchListItem">
<a href="javascript:void(0)">Search Keywords</a>
</li>
</ul>
<input runat="server" id="searchBox" type="text" />
ascx.vb 代码:
Private Sub Page_Load (...
`other code
Dim jobsLi As HtmlGenericControl
Dim jobsBox As HtmlGenericControl
jobsLi = CType(Page.FindControl("searchListItem"), HtmlGenericControl)
jobsBox = CType(Page.FindControl("searchBox"), HtmlGenericControl)
`other code
End Sub
当我单步执行代码jobsLi
并jobsBox
保持nothing
.