Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. nested grid problem

nested grid problem

Scheduled Pinned Locked Moved ASP.NET
cssdatabasedesignhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MaruBindiya
    wrote on last edited by
    #1

    i m using nested grid and in child grid i m using EmptyDataTemplate in which i hv one htmlanchor tag which is redirecting to another page when that child grid is empty and i m passing parentgridrow id as query string parameter to that anchor tag. here i m giving u code what i m using. Protected Sub ParentGrid_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles ParentGrid.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim s As SqlDataSource = CType(e.Row.FindControl("SqlDataSource1"), SqlDataSource) s.SelectParameters(0).DefaultValue = e.Row.Cells(0).Text CType(e.Row.FindControl("ChildGrid"), GridView).DataBind() End If End Sub Protected Sub grdProduct_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Dim grd As GridView = CType(sender, GridView) Dim grdr As New GridViewRow(-1, -1, DataControlRowType.EmptyDataRow , DataControlRowState.Normal) Dim cell As New TableCell cell.ColumnSpan = 2 cell.Width = Unit.Percentage(100) Response.Write(CType(sender, GridView).Rows.Count) End Sub it is giving output like shown below: 0 7 0 2 0 15 where 7 indicates 7 row of 1st child grid (child grid in 1st row of parent grid) same way 2 and 15 also means in my parent grid there r only 3 row (means there r only 3 child grid would created) then why i m geting other three zeros. can any one explain me the execution flow for nested grid. Thanx in advance,

    V 1 Reply Last reply
    0
    • M MaruBindiya

      i m using nested grid and in child grid i m using EmptyDataTemplate in which i hv one htmlanchor tag which is redirecting to another page when that child grid is empty and i m passing parentgridrow id as query string parameter to that anchor tag. here i m giving u code what i m using. Protected Sub ParentGrid_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles ParentGrid.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim s As SqlDataSource = CType(e.Row.FindControl("SqlDataSource1"), SqlDataSource) s.SelectParameters(0).DefaultValue = e.Row.Cells(0).Text CType(e.Row.FindControl("ChildGrid"), GridView).DataBind() End If End Sub Protected Sub grdProduct_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Dim grd As GridView = CType(sender, GridView) Dim grdr As New GridViewRow(-1, -1, DataControlRowType.EmptyDataRow , DataControlRowState.Normal) Dim cell As New TableCell cell.ColumnSpan = 2 cell.Width = Unit.Percentage(100) Response.Write(CType(sender, GridView).Rows.Count) End Sub it is giving output like shown below: 0 7 0 2 0 15 where 7 indicates 7 row of 1st child grid (child grid in 1st row of parent grid) same way 2 and 15 also means in my parent grid there r only 3 row (means there r only 3 child grid would created) then why i m geting other three zeros. can any one explain me the execution flow for nested grid. Thanx in advance,

      V Offline
      V Offline
      Venkatesh Mookkan
      wrote on last edited by
      #2

      MaruBindiya wrote:

      Protected Sub grdProduct_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)

      This Event is firing twice. That is before DataBinding (Empty Grid), and after DataBinding (With Data).

      Regards, Venkatesh Mookkan. Software Engineer, India My: Website | Yahoo Group | Blog Spot

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups