locked
usercontrol inside gridview RRS feed

  • Question

  • User2024669276 posted

    1. I have a gridview with 5 unbound columns, and has a button on its footer.
    2. When i click the button, it should load a usercontrol which should span across all the rows in the gridview. The usercontrol should be visible in its full displaying the 5 textboxes and a button inside it to Add a new row in the outer grid that hosts this usercontrol.
    3. Upon clicking the Add button inside the user control, the usercontrol should be invisible, and the grid should show a row added with the values filled in the textboxes by the user.
    4. More rows should be able to added in this inside the grid and making the usercontrol visible/invisible accordingly.

    Can someone pls give me some details on how the usercontrol can be added inside the gridview so that it spans across all the columns and satisfying the above functionality?

    Wednesday, June 29, 2011 9:02 PM

Answers

  • User2024669276 posted

    fyi, just wanted to let you know that i am achieving this using detailsview along with the gridview.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 5, 2011 11:43 AM

All replies

  • User-654786183 posted

    As my understanding with your requirement, you can go with jQuery UI dialog control or AJAX Modal-Popup extender.  

    1. Once the user clicks the footer button, show the dialog/Modal Popup which has the textboxes as you said
    2. On click of the save button, you can insert the record in the grid and close the Modal-Popup/Lightbox
    Please refer the following article by Matt Berseth
    Wednesday, June 29, 2011 10:18 PM
  • User2024669276 posted

    thanks for your reply, but i need to have everything inside the grid. if its not possible inside the grid, then is there any way that i can make it look that way?

    Wednesday, June 29, 2011 10:42 PM
  • User-654786183 posted

    Personally i would not suggest to put this kind of controls inside a gridview.  If you use jQuery UI, its just a div tag consisting of your text boxes and it will not be visible on load of the page.  Once you open the jQuery UI Dialog it will shade the entire background and it looks like a popup.  Please take a look at the live example of the same.

    http://jqueryui.com/demos/dialog/#modal

    Wednesday, June 29, 2011 10:47 PM
  • User2024669276 posted

    i appreciate your thoughts on this. but do you know a way in which i want to do it?

    Thursday, June 30, 2011 7:19 AM
  • User2024669276 posted

    fyi, just wanted to let you know that i am achieving this using detailsview along with the gridview.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 5, 2011 11:43 AM