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. Dynamic Item tmpate inside gridview

Dynamic Item tmpate inside gridview

Scheduled Pinned Locked Moved ASP.NET
csharpcssasp-netdatabasewpf
3 Posts 3 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.
  • S Offline
    S Offline
    sekannak
    wrote on last edited by
    #1

    Hi, I am creating item template dynamically inside gridview in Asp.net 2.0. The Item templates are sucessfully created.like as follows, Assume below as a grid view Rows & Columns : EmpID EmpName Basic HRA MA TA PF OTHER ------------------------------------------------------------- 1 Employe1 10000 1000 500 400 300 700 2 Employe2 20000 2000 800 600 400 800 3 Employe3 30000 2500 900 700 400 900 ------------------------------------------------------------- so the above coloumns as item template created dynamically First 2 column are labels and rest of the columns are textbox...So the first time loading the gridview with 3 rows empty - then i will enter data then i will save it to database... so UPTO here working fine... Note: The problem is i can change the text vaue from any rows any coloumn, i want find which rows and which cell was changed ,, how to find this..plz tell me ... i ll give code snippet, Gridview_RowCreatedEvent() If e.Row.RowType = DataControlRowType.DataRow The Dim txt As New TextBox For inti = 0 To 7 strname = "txt" & inti txt = CType(e.Row.FindControl(strname), TextBox) AddHandler txt.TextChanged, AddressOf txt_TextChanged Next End If Regards, Sekannak....

    kannak

    C A 2 Replies Last reply
    0
    • S sekannak

      Hi, I am creating item template dynamically inside gridview in Asp.net 2.0. The Item templates are sucessfully created.like as follows, Assume below as a grid view Rows & Columns : EmpID EmpName Basic HRA MA TA PF OTHER ------------------------------------------------------------- 1 Employe1 10000 1000 500 400 300 700 2 Employe2 20000 2000 800 600 400 800 3 Employe3 30000 2500 900 700 400 900 ------------------------------------------------------------- so the above coloumns as item template created dynamically First 2 column are labels and rest of the columns are textbox...So the first time loading the gridview with 3 rows empty - then i will enter data then i will save it to database... so UPTO here working fine... Note: The problem is i can change the text vaue from any rows any coloumn, i want find which rows and which cell was changed ,, how to find this..plz tell me ... i ll give code snippet, Gridview_RowCreatedEvent() If e.Row.RowType = DataControlRowType.DataRow The Dim txt As New TextBox For inti = 0 To 7 strname = "txt" & inti txt = CType(e.Row.FindControl(strname), TextBox) AddHandler txt.TextChanged, AddressOf txt_TextChanged Next End If Regards, Sekannak....

      kannak

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You can set the id of the control to contain a row index, then in your text changed event, check the id of the control that fired it. You can also use it's Tag property.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • S sekannak

        Hi, I am creating item template dynamically inside gridview in Asp.net 2.0. The Item templates are sucessfully created.like as follows, Assume below as a grid view Rows & Columns : EmpID EmpName Basic HRA MA TA PF OTHER ------------------------------------------------------------- 1 Employe1 10000 1000 500 400 300 700 2 Employe2 20000 2000 800 600 400 800 3 Employe3 30000 2500 900 700 400 900 ------------------------------------------------------------- so the above coloumns as item template created dynamically First 2 column are labels and rest of the columns are textbox...So the first time loading the gridview with 3 rows empty - then i will enter data then i will save it to database... so UPTO here working fine... Note: The problem is i can change the text vaue from any rows any coloumn, i want find which rows and which cell was changed ,, how to find this..plz tell me ... i ll give code snippet, Gridview_RowCreatedEvent() If e.Row.RowType = DataControlRowType.DataRow The Dim txt As New TextBox For inti = 0 To 7 strname = "txt" & inti txt = CType(e.Row.FindControl(strname), TextBox) AddHandler txt.TextChanged, AddressOf txt_TextChanged Next End If Regards, Sekannak....

        kannak

        A Offline
        A Offline
        Arun Jacob
        wrote on last edited by
        #3

        You can use the text changed event of the textbox.If u want that particular row just try this,

        GridviewRow gvRow = (sender as TextBox).NamingContainer

        Arun Jacob http://codepronet.blogspot.com/

        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