GridView Multi Select ?

Discussion in 'ASP .Net Web Controls' started by brianpmccullough, Dec 20, 2005.

  1. hello,

    I have just started playing with the GridView (Web Forms) control in ASP.NET
    2.0. I have an application that I would like to use the GridView to select
    multiple rows by simply clicking on the row, much like you can with a ListBox.

    First of all, is MultiSelect possible in the GridView control?

    Is there a way to get it to allow selection of a whole row by simply
    clicking on the row (similar to a listbox control)?

    Thanks!

    -Brian
     
    brianpmccullough, Dec 20, 2005
    #1
    1. Advertising

  2. Hi Brian,

    1- The GridView documentation only mention selectedRow attribute which
    returns a reference to a single row:
    http://msdn2.microsoft.com/en-us/library/y5cktw3x(en-US,VS.80).aspx

    2- Regarding your second question, search for a topic named "GridView whole
    row select" that we discussed on this forum on Nov 29, where a Select
    CommandField was created with a style that has display=none and a Javascript
    added during the RowDataBound event simulate a click of the select button.

    Another alternative, but a bit more involved, is to take control of saving
    indicators to the selected rows in <input type="hidden"> object on the
    webpage that you retrieve in the codebehind.
    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "brianpmccullough" wrote:

    > hello,
    >
    > I have just started playing with the GridView (Web Forms) control in ASP.NET
    > 2.0. I have an application that I would like to use the GridView to select
    > multiple rows by simply clicking on the row, much like you can with a ListBox.
    >
    > First of all, is MultiSelect possible in the GridView control?
    >
    > Is there a way to get it to allow selection of a whole row by simply
    > clicking on the row (similar to a listbox control)?
    >
    > Thanks!
    >
    > -Brian
     
    Phillip Williams, Dec 21, 2005
    #2
    1. Advertising

  3. One more idea to implement a MultiSelect GridView is to add a
    <asp:CheckBoxField > column as I did in this sample with the DataGrid:
    http://www.societopia.net/Samples/DataGrid_ChildControlsEvents.aspx

    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "Phillip Williams" wrote:

    > Hi Brian,
    >
    > 1- The GridView documentation only mention selectedRow attribute which
    > returns a reference to a single row:
    > http://msdn2.microsoft.com/en-us/library/y5cktw3x(en-US,VS.80).aspx
    >
    > 2- Regarding your second question, search for a topic named "GridView whole
    > row select" that we discussed on this forum on Nov 29, where a Select
    > CommandField was created with a style that has display=none and a Javascript
    > added during the RowDataBound event simulate a click of the select button.
    >
    > Another alternative, but a bit more involved, is to take control of saving
    > indicators to the selected rows in <input type="hidden"> object on the
    > webpage that you retrieve in the codebehind.
    > --
    > HTH,
    > Phillip Williams
    > http://www.societopia.net
    > http://www.webswapp.com
    >
    >
    > "brianpmccullough" wrote:
    >
    > > hello,
    > >
    > > I have just started playing with the GridView (Web Forms) control in ASP.NET
    > > 2.0. I have an application that I would like to use the GridView to select
    > > multiple rows by simply clicking on the row, much like you can with a ListBox.
    > >
    > > First of all, is MultiSelect possible in the GridView control?
    > >
    > > Is there a way to get it to allow selection of a whole row by simply
    > > clicking on the row (similar to a listbox control)?
    > >
    > > Thanks!
    > >
    > > -Brian
     
    Phillip Williams, Dec 21, 2005
    #3
  4. I just placed a demo for a GridView where you can select multiple rows:
    http://www.webswapp.com/CodeSamples/aspnet20/GridView_MultiSelect.aspx
    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "Phillip Williams" wrote:

    > Hi Brian,
    >
    > 1- The GridView documentation only mention selectedRow attribute which
    > returns a reference to a single row:
    > http://msdn2.microsoft.com/en-us/library/y5cktw3x(en-US,VS.80).aspx
    >
    > 2- Regarding your second question, search for a topic named "GridView whole
    > row select" that we discussed on this forum on Nov 29, where a Select
    > CommandField was created with a style that has display=none and a Javascript
    > added during the RowDataBound event simulate a click of the select button.
    >
    > Another alternative, but a bit more involved, is to take control of saving
    > indicators to the selected rows in <input type="hidden"> object on the
    > webpage that you retrieve in the codebehind.
    > --
    > HTH,
    > Phillip Williams
    > http://www.societopia.net
    > http://www.webswapp.com
    >
    >
    > "brianpmccullough" wrote:
    >
    > > hello,
    > >
    > > I have just started playing with the GridView (Web Forms) control in ASP.NET
    > > 2.0. I have an application that I would like to use the GridView to select
    > > multiple rows by simply clicking on the row, much like you can with a ListBox.
    > >
    > > First of all, is MultiSelect possible in the GridView control?
    > >
    > > Is there a way to get it to allow selection of a whole row by simply
    > > clicking on the row (similar to a listbox control)?
    > >
    > > Thanks!
    > >
    > > -Brian
     
    Phillip Williams, Dec 21, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Grandy
    Replies:
    0
    Views:
    621
    John Grandy
    Sep 13, 2005
  2. =?Utf-8?B?RGFiYmxlcg==?=

    select gridview row without using select button?

    =?Utf-8?B?RGFiYmxlcg==?=, Mar 3, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    101,540
    dch31969
    Feb 27, 2009
  3. Dave
    Replies:
    3
    Views:
    395
    Kevin Goodsell
    Apr 19, 2004
  4. Replies:
    38
    Views:
    1,283
    Dennis Lee Bieber
    Feb 15, 2005
  5. palmiere
    Replies:
    1
    Views:
    413
    Erwin Moller
    Feb 9, 2004
Loading...

Share This Page