<asp:DropDownList id="Drop_zipcode2" runat="server" Height="22" Width="103" AutoPostBack="true" onSelectedIndexChanged="Drop_zipcode2_SelectedIndexChanged"></asp:DropDownList>
然后添加一个函数:
Protected Sub Drop_zipcode2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
...
End Sub
然后添加一个函数:
Protected Sub Drop_zipcode2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
...
End Sub
解决方案 »
- 网页设计中TABLE中的行压缩问题
- response.binarywrite 下载大文件服务器死机问题?高手请进
- 这两段语句那个更好点啊.
- 为 GridView 添加了 <asp:CommandField ShowDeleteButton="True" HeaderText="删除" /> ,可是如何实现删除确认呢?
- 请问怎样将ASP.NET开发的B/S架构程序打包啊?
- 请加入技术系列群2307382,我们的家!!!
- .NET能否通过按钮另外弹出一个窗口,就像JS的window.open一样?
- jmail4.3收发邮件的例子(C#语言编)急!!
- 很笨的问题:水晶报表是什么东西^_^
- 控制台应用程序使用不了接口
- 请问TreeView的问题。。。
- 创建ASP.NET WEB应用程序时出错,求救
行 215: TB_areaname2 = CType(DL_plantharvest.FindControl("TB_areaname2"), TextBox)
行 216: Dim SelString_Drop_zipcode2 As String = "Select 区域名称 from CD_QYFW where 区域编码='" & Drop_zipcode2.SelectedItem.Text() & "'"
行 217: Dim connectStr_Drop_zipcode2 As String = "Provider=MSDAORA;Password=wsj2002;User ID=wsj;Data Source=WsjOrcl"
行 218: Dim DbAdapter_Drop_zipcode2 As OleDbDataAdapter = New OleDbDataAdapter(SelString_Drop_zipcode2, connectStr_Drop_zipcode2)异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
源文件: c:\inetpub\wwwroot\AppleDB\update_plantharvest.aspx.vb 行: 216
我在第214行添加定义了Drop_zipcode2为DropDownList,还是出现了以上错误。
Dim Drop_zipcode2 As DropDownList
Drop_zipcode2 = CType(DL_plantharvest.FindControl("Drop_zipcode2"), DropDownList)
Drop_zipcode2.DataSource=mydsBBS.Tables["UsersList"].DefaultView ;
Drop_zipcode2.DataTextField=区域名称字段
Drop_zipcode2.DataValueField=区域编码
Drop_zipcode2.DataBind();
然后将Private Sub Drop_zipcode2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Drop_zipcode2.SelectedIndexChanged
Dim TB_areaname2 As TextBox
TB_areaname2 = CType(DL_plantharvest.FindControl("TB_areaname2"), TextBox)
Dim SelString_Drop_zipcode2 As String = "Select 区域名称 from CD_QYFW where 区域编码='" & Drop_zipcode2.SelectedItem.Text() & "'"
Dim connectStr_Drop_zipcode2 As String = "Provider=MSDAORA;Password=wsj2002;User ID=wsj;Data Source=WsjOrcl"
Dim DbAdapter_Drop_zipcode2 As OleDbDataAdapter = New OleDbDataAdapter(SelString_Drop_zipcode2, connectStr_Drop_zipcode2)
Dim MyDataSet_Drop_zipcode2 As DataSet = New DataSet()
DbAdapter_Drop_zipcode2.Fill(MyDataSet_Drop_zipcode2, "CD_QYFW")
TB_areaname2.Text = MyDataSet_Drop_zipcode2.Tables("CD_QYFW").Rows(0).Item(0)
End Sub
中的---- Dim SelString_Drop_zipcode2 As String = "Select 区域名称 from CD_QYFW where 区域编码='" & Drop_zipcode2.SelectedItem.Text() & "'"
改为----- Dim SelString_Drop_zipcode2 As String = "Select 区域名称 from CD_QYFW where 区域编码='" & Drop_zipcode2.SelectedItem.Value() & "'"
TB_areaname2 = CType(DL_plantharvest.FindControl("TB_areaname2"), TextBox)
出错.
Dim cell As TableCell = CType(Drop_zipcode2.Parent, TableCell)
Dim TB_areaname2 As TextBox = CType(cell.FindControl("TB_areaname2"), TextBox)
Dim SelString_Drop_zipcode2 As String = "Select 区域名称 from CD_QYFW where 区域编码='" & Drop_zipcode2.SelectedItem.Text() & "'"
...
异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
不知该如何将它们定义?
还忘各位再出出主意!