嵌套网格视图问题

嵌套网格视图问题

本文介绍了嵌套网格视图问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在返回父级<code>gridview中数据绑定的标签的文本值时遇到问题.我需要使用文本值将其分配给子<code>gridview 中的select参数,但它始终抛出空引用.谁能看到下面的代码有问题吗?

I''m having problems returning the text value of a label that is databound in a parent <code>gridview. I need to use the text value to assign it to a select parameter in a child <code>gridview but it keeps throwing a null reference. Can anyone see a problem with the following code?

我有一个名为browsetopicsview的父Gridview,一个名为NestedPostCount 的子GridView和一个名为CreatedBy的databoud标签,这是我在子select的where子句中想要的陈述.  

I have a parent gridview called browsetopicsview, a child gridview called NestedPostCount a databoud label called CreatedBy which is what i want in the where clause of the child select statment.  

 Protected Sub BrowseTopicsView_RowDataBound(ByVal sender As Object,
               ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
                                    Handles BrowseTopicsView.RowDataBound
        Dim s As SqlDataSource = CType(e.Row.FindControl("NestedPostCount"),
                                                                 SqlDataSource)
        Dim g As New Label
        g = CType(FindControl("CreadtedBy"), Label)
        Try
            s.SelectParameters(0).DefaultValue = g.Text
        Catch
            MsgBox("An error has occured in the database,
                         please try again later")
        End Try
End Sub

    

 Thanks,   

Chris  

Chris  

 

推荐答案


这篇关于嵌套网格视图问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 06:27