|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
GridView Multi Select ?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 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 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 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
Bound dropdownlist in .NET 2.0 -- picking the selected value?
masterpages: body event handler <customErrors mode="Off"/> ERROR How to reference the masterpage body element in server code Repeater.Itemcommand not firing master-pages: naming problem for client-side scripting Button Click event not firing referencing and anchor from within a usercontrol (ascx) referencing and anchor from within a usercontrol (ascx) How to filter file types when using the HTMLInputFile control... |
|||||||||||||||||||||||