Hello,
I want to be able to pass an id through a querystring and select the row corresponding to that id on the grid, and that grid has paging enabled.
The code that i have working is very inefficient because in order to do this on a paged grid, I have to go through all pages, and rebind to have access to the items and see if the one I want to select is that one. I haven't found a better way to do this, does anyone knows if there is a better way to do this?
Ah, and it seems that the selected value of the combobox with the page size is and empty string when I do this instead of showing the actual size.
Thanks in advance!
I want to be able to pass an id through a querystring and select the row corresponding to that id on the grid, and that grid has paging enabled.
The code that i have working is very inefficient because in order to do this on a paged grid, I have to go through all pages, and rebind to have access to the items and see if the one I want to select is that one. I haven't found a better way to do this, does anyone knows if there is a better way to do this?
Ah, and it seems that the selected value of the combobox with the page size is and empty string when I do this instead of showing the actual size.
Thanks in advance!
if
(!Page.IsPostBack)
{
object
folderOb = Request.QueryString[
"Folder"
];
if
(folderOb ==
null
)
return
;
int
folderId =
int
.Parse(folderOb.ToString());
while
(grdFolders.CurrentPageIndex < grdFolders.PageCount)
{
foreach
(GridDataItem dataItem
in
grdFolders.Items)
{
Folder folder = dataItem.DataItem
as
Folder;
if
(folder.FolderId == folderId)
{
dataItem.Selected =
true
;
grdFolderIndex.Rebind();
return
;
}
}
++grdFolders.CurrentPageIndex;
grdFolders.Rebind();
}
}