I have 2 gridviews on one page. I want to give priority to the first gridview. I have applied paging on both the gridviews. I want second gridview to appear after the last page of first gridview. Is there any way to do so?
Related
I am working on a master/detail gridview and detailsview in asp.net web forms using an objectdatasource. The details view is displaying extra information about the selected row from the gridview. When I sort the grid, I want the currently selected row, before sort occurs, to remain in the details view after the sort is completed. Instead, the gridview is auto selecting the new first row whenever I sort.
I found a partial solution to this problem. If I set WhateverGridview.SelectedIndex= -1 onsort and the value becomes null. This makes it deselect any rows after a sort. This leaves the details view blank. However, what I want to do is maintain the selected row not nullify it.
So, does anyone have a good way to retain the selected value or prevent the details view from displaying after sort event fires.
Here you need to use the GridView.EnablePersistedSelection property. Set this property to true.
Setting this property to true means that GridView will make sure that the selection of a row is based on data-key values.
By default GridView makes row selections based on index. This is the reason why when you sort, gridview is selecting row based on index and you lose your actual selected row.
I have a page where there is a grand parent grid - displaying categories. Then under each category comes Items - the second grid and under each item come one or more sub-items again a grid. The number of categories, items, sub-items vary based on the shop selected from previous page in the flow. My question is how can i improve rendering of the page? It is taking too much of time to render above data.
Note:- i cannot use paging in the grid....
I bind the items grid on RowDataBound event of categories grid and Sub-Items on RowDataBound event of Items grid.
You are creating way too many grids. A grid is an expensive component.
You could alter your user interface to allow users to select an Item and bind the inner grid only on selection. This ensures that rather than one grid per row or parent grid, you will have only one child grid displayed at a time.
I have a gridview with multiple dropdownlist, textboxes on footer template and I wanted to add the values entered to the grid.
However, I have a condition where the second dropdownlist has to be loaded by based on what is selected in the first dropdownlist.
Is this possible? any examples would be greatly appreciated.
Have a look at this very good Example: Implementing Cascading DropDownList in ASP.NET GridView
And if you want an AJAX based method, take a look at: Ajax Cascading DropDownList With Database Example in GridView
i have a webpage that loads data into a gridview and refreshes the gridview every few seconds. I do this via a asp:Timer which runs a C# function every few seconds to requery the database and databind the gridview.
I also have a few dropdown lists to filter data from the gridview. These dropdown lists get their data from the same dataset as the gridview (e.g. if the gridview shows the stats of all apples being plucked from trees, then the list may contain e.g. all distinct apple types). How i refresh these dropdown lists is again to requery the dataset and reset the selected index to be one selected at time of refresh. So this causes a problem where the timer is up when the dropdown list is open - the index on the dropdown list is selected and refreshes the gridview, the dropdown list also refreshes with the current selected index and closes.
So the question i have how to disable my timer refresh from going off while the dropdown lists are active - or maybe how do i do this better?
edit: forgot to mention that i'm using ajax / UpdatePanel for the refresh
The first thing you need to do is define some event to capture when the dropdown is open. I dont think there is one, but you could use focus() events ... maybe.
Then when the dropdown list is open, you need to disable the timer client-side. This article explains it (though using a checkbox)
http://weblogs.asp.net/aboschin/archive/2007/10/06/ajax-how-to-control-an-lt-asp-timer-gt-on-client-side.aspx
How can I Display selected row of Gridview data to next page in another Gridview?
For example,
In listing page I want to select particular row and take that data to another page and display over there.
I have two grid view one in 1st page
and next one in 2nd page. Now when I
select a record in 1st page gridview,
than that record will display on 2nd
page gridview on submit button click
from 1st page.
Pass the key of the record via the querystring... and then in rowdatabound event, select the row when the data bound record matches the key in the QS.
For more protection, you can use session to store the variable.
Why not have 2 gridviews, one above the other? The top gridview could be made to only show 1 record which is set to the id of the 2nd gridviews selected item identifier in code. Then in 2nd gridview, have an empty selected item template so that the selected item only shows once for both gridviews. That way the 2nd gridview is free to page through the entire set whilst the first retains the selected item for display above?