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. Web Development
  3. ASP.NET
  4. Gridview Row created Event

Gridview Row created Event

Scheduled Pinned Locked Moved ASP.NET
questioncsshelp
6 Posts 4 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.
  • 4 Offline
    4 Offline
    4anusha4
    wrote on last edited by
    #1

    I used gridviewrowcreated event in order to create a heading row for the grid First time it executes well after that for every event that is fired on the page the control is coming directly the gridviewrowcreated event How can i solve this problem?

    K 1 Reply Last reply
    0
    • 4 4anusha4

      I used gridviewrowcreated event in order to create a heading row for the grid First time it executes well after that for every event that is fired on the page the control is coming directly the gridviewrowcreated event How can i solve this problem?

      K Offline
      K Offline
      Kannan Ar
      wrote on last edited by
      #2

      It is hard to assume the problem from your obscure post. Do you want write some code that should execute only when the creation of header row? Then you should write it in an "if" block which checks the row type is header row.

      4 1 Reply Last reply
      0
      • K Kannan Ar

        It is hard to assume the problem from your obscure post. Do you want write some code that should execute only when the creation of header row? Then you should write it in an "if" block which checks the row type is header row.

        4 Offline
        4 Offline
        4anusha4
        wrote on last edited by
        #3

        if (e.Row.RowType == DataControlRowType.Header) { //Build custom header. GridView gvGrid = (GridView)sender; GridViewRow gvRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert); TableCell tblCell = new TableCell(); TableCell tblCell1 = new TableCell(); //Add Department tblCell.Text = "Attendance Report From:" + Convert.ToDateTime(sFromDate.ToString()).ToString("dd/MM/yyyy") + "-" + "To" + Convert.ToDateTime(sToDate.ToString()).ToString("dd/MM/yyyy"); tblCell.ColumnSpan = 6; tblCell.ForeColor = System.Drawing.Color.Black; tblCell.Font.Bold = true; tblCell.Font.Size = 14; gvRow.Cells.Add(tblCell); tblCell.HorizontalAlign = HorizontalAlign.Left; gvGrid.Controls[0].Controls.AddAt(0, gvRow); } I used this code first time it executes well after that when any event is fired on the page the control comes to this rowcreated event its not even entering into page_load and all the text in the textbox controls were being cleared

        modified on Thursday, October 8, 2009 12:42 AM

        J S 2 Replies Last reply
        0
        • 4 4anusha4

          if (e.Row.RowType == DataControlRowType.Header) { //Build custom header. GridView gvGrid = (GridView)sender; GridViewRow gvRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert); TableCell tblCell = new TableCell(); TableCell tblCell1 = new TableCell(); //Add Department tblCell.Text = "Attendance Report From:" + Convert.ToDateTime(sFromDate.ToString()).ToString("dd/MM/yyyy") + "-" + "To" + Convert.ToDateTime(sToDate.ToString()).ToString("dd/MM/yyyy"); tblCell.ColumnSpan = 6; tblCell.ForeColor = System.Drawing.Color.Black; tblCell.Font.Bold = true; tblCell.Font.Size = 14; gvRow.Cells.Add(tblCell); tblCell.HorizontalAlign = HorizontalAlign.Left; gvGrid.Controls[0].Controls.AddAt(0, gvRow); } I used this code first time it executes well after that when any event is fired on the page the control comes to this rowcreated event its not even entering into page_load and all the text in the textbox controls were being cleared

          modified on Thursday, October 8, 2009 12:42 AM

          J Offline
          J Offline
          janani13
          wrote on last edited by
          #4

          Is the page is loaded with !ispostback.

          1 Reply Last reply
          0
          • 4 4anusha4

            if (e.Row.RowType == DataControlRowType.Header) { //Build custom header. GridView gvGrid = (GridView)sender; GridViewRow gvRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert); TableCell tblCell = new TableCell(); TableCell tblCell1 = new TableCell(); //Add Department tblCell.Text = "Attendance Report From:" + Convert.ToDateTime(sFromDate.ToString()).ToString("dd/MM/yyyy") + "-" + "To" + Convert.ToDateTime(sToDate.ToString()).ToString("dd/MM/yyyy"); tblCell.ColumnSpan = 6; tblCell.ForeColor = System.Drawing.Color.Black; tblCell.Font.Bold = true; tblCell.Font.Size = 14; gvRow.Cells.Add(tblCell); tblCell.HorizontalAlign = HorizontalAlign.Left; gvGrid.Controls[0].Controls.AddAt(0, gvRow); } I used this code first time it executes well after that when any event is fired on the page the control comes to this rowcreated event its not even entering into page_load and all the text in the textbox controls were being cleared

            modified on Thursday, October 8, 2009 12:42 AM

            S Offline
            S Offline
            sashidhar
            wrote on last edited by
            #5

            try to keep the breakpoint on all the events which are present in the code page..!Then try to debug the page You can find the error..!

            MyFirstArticlePublished: MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.

            4 1 Reply Last reply
            0
            • S sashidhar

              try to keep the breakpoint on all the events which are present in the code page..!Then try to debug the page You can find the error..!

              MyFirstArticlePublished: MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.

              4 Offline
              4 Offline
              4anusha4
              wrote on last edited by
              #6

              i tried it but could not found

              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