vb.net(web) 在页面类的自定义函数中如何应用页面中的控件???
刚开始学web开发,请各路大侠多多指教!!!以下是源代码,参照以前vb的,总是出错
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Ajax.Utility.RegisterTypeForAjax(GetType(WebForm1))
End Sub
Public Sub SetTextValue(ByVal sId As String, ByVal sValue As String)
TextBox1.Text = sValue
End Sub
<Ajax.AjaxMethod()> _
Public Function GetCzyInfo(ByVal sId As String) As DataSet
Dim strSql As String
strSql = "select * from czyxxb where id='" & sId & "'"
strCn = "Provider=SQLOLEDB.1;Password=sql;Persist Security Info=True;User ID=sa;" & "Data Source=hxb;Initial Catalog=aid_register"
ADOcmd = New OleDbDataAdapter(strSql, strCn)
ADOcmd.Fill(ds, strCn)
mytable = ds.Tables.Item(0)
myrow = mytable.Rows.Item(rownumber)
Dim sWebF As New WebForm1
sWebF.SetTextValue("ddd", "eeee")
Return ds
End Function
End Class
错误为:TextBox1为Nothing
补充:.NET技术 , VB.NET