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. inserting multiple rows at a time

inserting multiple rows at a time

Scheduled Pinned Locked Moved ASP.NET
helpcssdatabaseannouncement
5 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.
  • Y Offline
    Y Offline
    yuvachandra
    wrote on last edited by
    #1

    Hai all,, Actually i got a grid control on which am displaying some content from the database..by using the template columns....i have bounded the content with the datagrid in such a way that information in the all the rows is editable(say 10 rows each of 3 columns) i.e by placeing textbox in the itemtemplate....Know whats the problem is--->am using a button(only one) in the footer of the grid ...while i clicked on the button i want to update the database with the updated information in the editable textboxes(all the content)..plz help me out or send me any article related to this :rose:

    S 1 Reply Last reply
    0
    • Y yuvachandra

      Hai all,, Actually i got a grid control on which am displaying some content from the database..by using the template columns....i have bounded the content with the datagrid in such a way that information in the all the rows is editable(say 10 rows each of 3 columns) i.e by placeing textbox in the itemtemplate....Know whats the problem is--->am using a button(only one) in the footer of the grid ...while i clicked on the button i want to update the database with the updated information in the editable textboxes(all the content)..plz help me out or send me any article related to this :rose:

      S Offline
      S Offline
      Sherin Iranimose
      wrote on last edited by
      #2

      Hi Yuvachandra, Why you are displaying all data in textboxes. If you need that there will happen unwanted data changes.Am I right? If you want to find which textbox is changed,You should iterate through all. So if dimension is 10x3 you should make 30 iteration.If the direction is bigger than that???(it is possible to do but...time...complexity..) I think, you know that there is a provision in grid that, we can make a Particular row to be editable. I think it is better to go on that way. And now also, if you really need it.....Post... we will try...


      To succeed, we must first believe that we can. Sherin Iranimose


      Y 1 Reply Last reply
      0
      • S Sherin Iranimose

        Hi Yuvachandra, Why you are displaying all data in textboxes. If you need that there will happen unwanted data changes.Am I right? If you want to find which textbox is changed,You should iterate through all. So if dimension is 10x3 you should make 30 iteration.If the direction is bigger than that???(it is possible to do but...time...complexity..) I think, you know that there is a provision in grid that, we can make a Particular row to be editable. I think it is better to go on that way. And now also, if you really need it.....Post... we will try...


        To succeed, we must first believe that we can. Sherin Iranimose


        Y Offline
        Y Offline
        yuvachandra
        wrote on last edited by
        #3

        ya...it is compulsary,,bcz there is a scenarion that i ahve to expose all the content to my enduser..anyhow i finded the solution.....Thanks for ur kind reply... this is the code i used foreach(DataGridItem val in DataGrid1.Items) { string st,st1,st2; st=((Label)val.Cells[0].FindControl("lblAccountId")).Text; st1=((TextBox)val.Cells[1].FindControl("AccCode")).Text; st2=((TextBox)val.Cells[2].FindControl("Descrip")).Text; dataAdapter=new SqlDataAdapter("update AccountCode set AccountCode='" + st1 + "',Description='" + st2 + "'where AccountId=" + st,con); dataAdapter.Fill(ds,"contentTable"); }

        S 1 Reply Last reply
        0
        • Y yuvachandra

          ya...it is compulsary,,bcz there is a scenarion that i ahve to expose all the content to my enduser..anyhow i finded the solution.....Thanks for ur kind reply... this is the code i used foreach(DataGridItem val in DataGrid1.Items) { string st,st1,st2; st=((Label)val.Cells[0].FindControl("lblAccountId")).Text; st1=((TextBox)val.Cells[1].FindControl("AccCode")).Text; st2=((TextBox)val.Cells[2].FindControl("Descrip")).Text; dataAdapter=new SqlDataAdapter("update AccountCode set AccountCode='" + st1 + "',Description='" + st2 + "'where AccountId=" + st,con); dataAdapter.Fill(ds,"contentTable"); }

          S Offline
          S Offline
          Sherin Iranimose
          wrote on last edited by
          #4

          Hi, It is a good work. But the text box is not changed also, it will update. That means if I've 10 rows and I changed only first row.It will try to update all the 10 rows.Is that you really need?


          To succeed, we must first believe that we can. Sherin Iranimose


          Y 1 Reply Last reply
          0
          • S Sherin Iranimose

            Hi, It is a good work. But the text box is not changed also, it will update. That means if I've 10 rows and I changed only first row.It will try to update all the 10 rows.Is that you really need?


            To succeed, we must first believe that we can. Sherin Iranimose


            Y Offline
            Y Offline
            yuvachandra
            wrote on last edited by
            #5

            that's wasn't i mean..but this is kind of situation( i even contradict with mt lead )we must and should expose all the boxes to be editable though he may update 1 or 2 boxes of many(ofcourse it's a unnesessary burdon,i know) ..anyhow thanqs for ur kind and honest replay:rose::rose:

            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