Home All Groups Group Topic Archive Search About
Author
20 Dec 2005 3:45 PM
brianpmccullough
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

Author
21 Dec 2005 4:52 PM
Phillip Williams
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.
Show quoteHide quote
"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
Author
21 Dec 2005 5:25 PM
Phillip Williams
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

Show quoteHide quote
"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
Author
21 Dec 2005 10:57 PM
Phillip Williams
I just placed a demo for a GridView where you can select multiple rows:
http://www.webswapp.com/CodeSamples/aspnet20/GridView_MultiSelect.aspx
Show quoteHide quote
"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