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
  1. Home
  2. General Programming
  3. C#
  4. Nested Grid View Probelm

Nested Grid View Probelm

Scheduled Pinned Locked Moved C#
helpcsharpcssasp-netsysadmin
1 Posts 1 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.
  • V Offline
    V Offline
    veereshIndia
    wrote on last edited by
    #1

    Hi all, Iam doing nested data grid operations iam facing a problem in that please help me on this I have a gridview controls in asp.net page which is fetching data from data base then RowDataBound of that data grid iam creating gridview dynamically i.e means if there is 3 records in main gridview its creating 3 child gridview which has few data i want to access the data of the child grid views but i can access only the last child grid views data not all the child grid view data.i have attached my code here plase have a look on it. protected void GridView_RowDataBound1(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.EmptyDataRow) { id++; Int64 catId =Convert.ToInt64(e.Row.Cells[1].Text.ToString()); ds = new DataSet(); ds = objExitInterviewBLL.getQuestions(0, 'S', "", catId); int count = 0; if (ds.Tables[0].Rows.Count > 0) { NewDg = new GridView(); //NewDg= new GridView(); NewDg.ID = "NewDg" + id ; txtHidden.Text = txtHidden.Text + "," + NewDg.ID; NewDg.Attributes.Add("runat", "server"); NewDg.AutoGenerateColumns = false; BoundField bc1 = new BoundField(); bc1.DataField = "Sno"; bc1.HeaderText = "Sno"; BoundField bc2 = new BoundField(); bc2.DataField = "Question"; bc2.HeaderText = "Question"; BoundField bc3 = new BoundField(); bc3.DataField = "Responsetp"; bc3.Visible = false; TemplateField tc1 = new TemplateField(); tc1.ItemTemplate = new DataGridTemplate(ListItemType.Item, "Column1"); tc1.HeaderText = "Answers"; NewDg.Columns.Add(bc1); NewDg.Columns.Add(bc2); NewDg.Columns.Add(bc3); NewDg.Columns.Add(tc1); NewDg.DataSource = ds.Tables[0]; NewDg.DataBind(); while (ds.Tables[0].Rows.Count > count)

    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