Yes i am using 3.5. When i select on the gridview it takes me to the selectedindexchanged event handler....but putting the code you sent does not do anything on when i run it. I am just trying to make sure when i select on row from a grid....it makes the
other one invinsible so users dont get confused....
It does not show me any error when i put in the code. The only time it shows me an error is when i use the "Import system.linq".....it does not let me access my application at all.
I hope you understand what i am trying to do here.?
What happes is that my gridview is populated from the db....So it as a selectcommand at the sqldatasource. The selectcommand is selecting all the data in the table and once its clicked on the gridview.....the child grid pops up....its working well now...
but i was woundering if its possible that if i select one of the records it hides the others so users dont get confused. Now.... once i am done with that record.... i can refresh so.... all the hidden data would come back.... Am not sure if this is duable.
Thanks setting visible to true when i need to see it again.... Is it something that can be done dynamically .? it seems one would have to manually change it based on what you said....might be worng... Tried the importing the system.linq again....it would
not allow me view my page at all
''' <summary>
''' Displays only selected row and hides other rows
''' </summary>
Public Sub ShowOnlySelectedRows()
For Each row In GridViewAll.Rows
If (row.RowIndex <> GridViewAll.SelectedIndex) Then
row.Visible = False
End If
Next
End Sub
''' <summary>
''' Displays all rows in the gridview
''' </summary>
Public Sub ShowAllRows()
For Each row In GridViewAll.Rows
row.Visible = True
Next
End Sub
call the function ShowOnlyselectedRows when you select the row and
call the function ShowAllRows when you cancel your selection.
Everything is dynamic and event driven here, nothing is manual as such.
Thanks...but where do i put this code in my application. And i assume this is JavaScript....I hope it fine since i am using VB.net.. Please let me know and thanks so much for your help so far
oluts
Member
30 Points
299 Posts
Re: GridView Select
Jun 28, 2010 01:57 PM|LINK
Hisham,
Yes i am using 3.5. When i select on the gridview it takes me to the selectedindexchanged event handler....but putting the code you sent does not do anything on when i run it. I am just trying to make sure when i select on row from a grid....it makes the other one invinsible so users dont get confused....
oluts
Member
30 Points
299 Posts
Re: GridView Select
Jun 28, 2010 01:59 PM|LINK
Decker,
It does not show me any error when i put in the code. The only time it shows me an error is when i use the "Import system.linq".....it does not let me access my application at all.
I hope you understand what i am trying to do here.?
Hisham.NET
Participant
1794 Points
460 Posts
Re: GridView Select
Jun 28, 2010 04:26 PM|LINK
Hi again ...
Tell me if you hide the other rows how can you select them again?!!
oluts
Member
30 Points
299 Posts
Re: GridView Select
Jun 28, 2010 04:33 PM|LINK
Hisham,
What happes is that my gridview is populated from the db....So it as a selectcommand at the sqldatasource. The selectcommand is selecting all the data in the table and once its clicked on the gridview.....the child grid pops up....its working well now... but i was woundering if its possible that if i select one of the records it hides the others so users dont get confused. Now.... once i am done with that record.... i can refresh so.... all the hidden data would come back.... Am not sure if this is duable.
sansan
All-Star
53942 Points
8147 Posts
Re: GridView Select
Jun 28, 2010 04:33 PM|LINK
Add the Reference to you project or website from System.Linq or if you add System.Core, you should be able to get that Import Declaration working.
If you want to show the other rows again, set the visible to true.
As you are not re binding the gridview, viewstate will be persisted and hide and show should work fine.
oluts
Member
30 Points
299 Posts
Re: GridView Select
Jun 28, 2010 04:42 PM|LINK
Thanks setting visible to true when i need to see it again.... Is it something that can be done dynamically .? it seems one would have to manually change it based on what you said....might be worng... Tried the importing the system.linq again....it would not allow me view my page at all
sansan
All-Star
53942 Points
8147 Posts
Re: GridView Select
Jun 28, 2010 05:21 PM|LINK
OK, Leave that LINQ and use these two functions:
''' <summary> ''' Displays only selected row and hides other rows ''' </summary> Public Sub ShowOnlySelectedRows() For Each row In GridViewAll.Rows If (row.RowIndex <> GridViewAll.SelectedIndex) Then row.Visible = False End If Next End Sub ''' <summary> ''' Displays all rows in the gridview ''' </summary> Public Sub ShowAllRows() For Each row In GridViewAll.Rows row.Visible = True Next End Subcall the function ShowOnlyselectedRows when you select the row and
call the function ShowAllRows when you cancel your selection.
Everything is dynamic and event driven here, nothing is manual as such.
Hisham.NET
Participant
1794 Points
460 Posts
Re: GridView Select
Jun 28, 2010 08:35 PM|LINK
Hi sansan ...
You 're right, or you can bind it again.
oluts
Member
30 Points
299 Posts
Re: GridView Select
Jun 29, 2010 03:20 PM|LINK
Sansan,
Thanks...but where do i put this code in my application. And i assume this is JavaScript....I hope it fine since i am using VB.net.. Please let me know and thanks so much for your help so far
sansan
All-Star
53942 Points
8147 Posts
Re: GridView Select
Jun 29, 2010 03:34 PM|LINK
That is VB.NET Code only.
Call the function ShowOnlySelectedRows() in your selected index changed event which shows selected row and hides other rows
Call the function ShowAllRows() whenever you reset the gridview to show all rows (when user cancels the selection)
Hope this helps.