我做了这段代码,但它给了我一个错误,说未声明gridview [英] I did this code but its giving me an error saying that the gridview is not declared

查看:67
本文介绍了我做了这段代码,但它给了我一个错误,说未声明gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Public Sub lp_populate(ByVal ps_SQLStr As String)
        Dim ls_constr As String
        ls_constr = "Data Source=DEFAULT-PC;Initial Catalog=IDMS_DEV;User ID=sa;Password=develop"
        Dim lo_sqladapter As SqlDataAdapter
        Dim lo_con As SqlConnection
        lo_con = New SqlConnection(ls_constr)
        lo_con.Open()
        Dim lo_dataset As New DataSet
        lo_sqladapter = New SqlDataAdapter(ps_SQLStr, lo_con)
        lo_sqladapter.SelectCommand.ExecuteNonQuery()
        lo_sqladapter.Fill(lo_dataset)

        GridViewEmp.DataSource = lo_dataset
        GridViewEmp.DataBind()
    End Sub

推荐答案

除非您已将GridView添加到名为"GridViewEmp"的页面并将其设置为runat="server",否则将无法看到它.
检查定义,确保runat部分在那里,并且名称匹配.
Unless you have added a GridView to your page called "GridViewEmp" and set it to runat="server" it won''t be able to see it.
Check the definition, make sure that the runat part is there, and that the name matches.


如果您在Windows应用程序中工作,
您在页面上有此网格,但仍然显示未声明的错误
然后选中"GenerateMember"属性应设置为"True"

祝您编码愉快!
:)
if you are working in windows application,
you have this grid on page, and still it shows error for not declared
then check ''GenerateMember'' property should be set to ''True''

Happy Coding!
:)


这篇关于我做了这段代码,但它给了我一个错误,说未声明gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆