改正一下check()
Sub check(ByVal sender As System.Object, ByVal e As System.EventArgs)
'CType(Datagrid1.FindControl("ddl_gn")为页脚的控件
Dim a As DropDownList = CType(Datagrid1.FindControl("ddl_gn"), DropDownList)
If a.SelectedItem.Text = "超级用户" Then 'CType(Datagrid1.FindControl("txt_bz")为页脚的控件
Dim b As TextBox = CType(Datagrid1.FindControl("txt_bz"),TextBox)
b.Text = a.SelectedItem.Text
End If
End Sub
---------------------------------------------------------------------
Sub check(ByVal sender As System.Object, ByVal e As System.EventArgs)
'CType(Datagrid1.FindControl("ddl_gn")为页脚的控件
Dim a As DropDownList = CType(Datagrid1.FindControl("ddl_gn"), DropDownList)
If a.SelectedItem.Text = "超级用户" Then 'CType(Datagrid1.FindControl("txt_bz")为页脚的控件
Dim b As TextBox = CType(Datagrid1.FindControl("txt_bz"),TextBox)
b.Text = a.SelectedItem.Text
End If
End Sub
---------------------------------------------------------------------
解决方案 »
- 怎样可以做到在.net Web项目安装时由用户自定义安装路径?
- 主页放在网站根目录下的web文件下的问题.
- ▲▲▲▲请教高手!!!怎么实现:GridView的头中创建一个DropDownList控件,对数据进行筛选。
- 为什么不能在DATAGRID个取得它的关键字段的值?
- 有遇到过该问题的DX进来看看!“无法访问已关闭的资源集”
- dreamwave好还是vs.net好 对于编写asp网页 (讨论)
- web.config问题
- VS2010发布目标框架2.0.子目录文件打不开?
- 关于局部变量传递值的问题!!!
- 怎样把数据库的记录内容直接变成WEB页面
- 求一个配色方案,tab页
- 两个小问题,Inherits是什么意思?如:Inherits="exTest.WebForm1"。还有就是.aspx里的按钮怎么和.aspx.vb里的事件连不上?
不会有什么问题的
为什么要这样写?不是很明白
ddl_gn是(datagrid)中页脚的子控件
可以讲讲码?
-------------------------------------------------------------------------------
未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误:
行 156: 'Dim cc As DataRow = Datagrid1.FindControl("ddl_gn")
行 157: 'Dim b As DropDownList = CType(a.FindControl("ddl_gn"), DropDownList)
行 158: If CType(Datagrid1.FindControl("ddl_gn"), DropDownList).SelectedItem.Text = "超级用户" Then
行 159: Dim c As TextBox = CType(Datagrid1.FindControl("txt_bz"), TextBox)
行 160: c.Text = "9999"
源文件: E:\_asp.net_\dropdownlist_test\WebForm1.aspx.vb 行: 158 堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
dropdownlist_test.WebForm1.check(Object sender, EventArgs e) in E:\_asp.net_\dropdownlist_test\WebForm1.aspx.vb:158
System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e)
System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent()
System.Web.UI.Page.RaiseChangedEvents()
System.Web.UI.Page.ProcessRequestMain() +1070
--------------------------------------------------------------------------------
版本信息: Microsoft .NET 框架版本:1.0.3705.0; ASP.NET 版本:1.0.3705.0