Have a probem in Editing in the row of grid view in a strange way?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AnagJohari
    New Member
    • May 2010
    • 96

    Have a probem in Editing in the row of grid view in a strange way?

    actually i want to edit the row of an grid view by code behind not using any sql data source. u know that that show edit button property in a grid view

    when we set this property to true & simply connect it to the sql data source
    we use a update command property in sql data source
    by doing all this we create a such type of data grid in which
    edit button is display in every row when u click on edit button then the corresponding row is opened in editable form. & update & cancel button is display when u hit on update button the value is updated & row is converted in noneditable form.....

    Now i donot want to use edittemplate & donot want to add textboxes in edit template
    & donot want to use sqldatasource
    can we do the above thing by code behind just like i mention in the above details
    by using such type of property which i discusses above
    that we can open a row of an grid view in editable form without using edittemplate
    & update the data from codebehind which value i mention in editable row.
    Thank you
  • PRR
    Recognized Expert Contributor
    • Dec 2007
    • 750

    #2
    Can you specify what exactly you want to do? You can handle the Gridview.Rowupd ating event for Gridview and do the update. Obviously you need have TemplateField with EditItemTemplat e.

    Comment

    • AnagJohari
      New Member
      • May 2010
      • 96

      #3
      Originally posted by PRR
      Can you specify what exactly you want to do? You can handle the Gridview.Rowupd ating event for Gridview and do the update. Obviously you need have TemplateField with EditItemTemplat e.
      you just add show edit button property in grid view & run the program Then grid view will display edit button in every row of an grid view i know that when you click on edit button there is an error because of unhandling the event.
      u know that when i use sql datasource & use updatecommand property & write update query in update command & after that bind sqldatasource with grid view
      after that you run your program & click on edit button then row is opened in editable form & updation is done....
      Same functionality i want to use through code behind without sql datasource

      Comment

      • PRR
        Recognized Expert Contributor
        • Dec 2007
        • 750

        #4
        Go to gridview properties and click on events... you need to handle the appropriate events.
        Link

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          Originally posted by AnagJohari
          AnagJohari: Then grid view will display edit button in every row of an grid view i know that when you click on edit button there is an error because of unhandling the event
          You do not have to use the SqlDataSource. I never do....
          In fact I'm doing exactly what you want to do in several different projects.

          I created a Web User Control used for display/editing purposes. This control is on the same page as the GridView but is invisible (Visible=false) so it's not rendered.

          When the user clicks the edit button...it is handled by the method in my VB.NET code (this could be C#...same difference) which retrieves the data from the row selected for editing and uses that to populate the Web User Control with information. After the Web User Control is populated, I set the GridView.Visibl e=False and my Web User Control.Visible = True.

          Now the GridView is hidden and the user sees the editable details.


          I use this technique because the GridView only displays general information and the Web User Control displays all of the information about whatever the user is working with.

          So, please look at the link that PRR posted.
          It explains how to Handle the Editing event.

          Then consider what I said and give it a try.

          -Frinny

          Comment

          • AnagJohari
            New Member
            • May 2010
            • 96

            #6
            Originally posted by Frinavale
            You do not have to use the SqlDataSource. I never do....
            In fact I'm doing exactly what you want to do in several different projects.

            I created a Web User Control used for display/editing purposes. This control is on the same page as the GridView but is invisible (Visible=false) so it's not rendered.

            When the user clicks the edit button...it is handled by the method in my VB.NET code (this could be C#...same difference) which retrieves the data from the row selected for editing and uses that to populate the Web User Control with information. After the Web User Control is populated, I set the GridView.Visibl e=False and my Web User Control.Visible = True.

            Now the GridView is hidden and the user sees the editable details.


            I use this technique because the GridView only displays general information and the Web User Control displays all of the information about whatever the user is working with.

            So, please look at the link that PRR posted.
            It explains how to Handle the Editing event.

            Then consider what I said and give it a try.

            -Frinny
            your mean i create such type of webcontrol in which when you hit a perticular row in a grid view then grid view is disappear & that perticular row is displayed in editable form with the stored data & after doing changes in that perticular row that editable row is disappear & the grid view with updated that row will appeared.
            i want to use a grid view also for that editable row in which we do changes
            That thing you explain me.......

            Comment

            • AnagJohari
              New Member
              • May 2010
              • 96

              #7
              Originally posted by PRR
              Can you specify what exactly you want to do? You can handle the Gridview.Rowupd ating event for Gridview and do the update. Obviously you need have TemplateField with EditItemTemplat e.
              now i have completed all this by handling event. but i want this in diffrent manner as frinny mentioned

              Comment

              Working...