I have an asp:ListView control which list playlists. It has paging supported and holds 10 playlists per page. Currently, when the user clicks a view link under a playlist, it redirects them to another page where they can view the songs in the playlist. If they want to edit the songs in the playlist, they can click an edit link and it will redirect them back to the the page with the playlists and it will display a panel with the songs in the list they can add and remove. This works fine if the item they are editing is on the first page, but if the item is not on the first page, the item that gets market for editing is the first item on the first page, so I guess my question is, how do I get to the page of the ListView that the item is on. Currently in my Page Load, I have the following:
if (!Page.IsPostBack)
{
LoadPlaylists();
if(Request.QueryString["edit"] != null)
{
ListViewEditEventArgs args = new
ListViewEditEventArgs(FindEditItemIndex(Request.QueryString["edit"]));
lvwPortfolios_RowEditing(this.lvwPlaylists, args);
}
}
I am using a DataPager control to handle the paging.
This is where it gets it query string from:
protected void lnkEditPlaylist_Click(object sender, EventArgs e)
{
Response.Redirect("~/playlist/playlist.aspx?edit=" + lblPlaylistName.Text.Trim());
}
Interesting thing to note is that I believe it puts the correct item in edit mode, but it does not jump to the correct page, it stays on the first page of the listview, so it looks like it is an issue with the datapager control. Is it just as simple as programmatically jumping to the correct page?