Hi All,
I have two grid views on one asp.net page with sorting and pagination enabled. When I use paging or sorting functionality of one grid view the pager on the other grid view disappears.
please help!
thanks,
Ameya
Hi,
Please post your code for us to find out the issue.
Yes, Please submit the code.
But my primary guess would be that your post back(assuimg that you are NOT using update panel and paging and sorting the first grid on sever side) is causing the second gridview to reload and there after we need to see your code.....
Hi Guys,
Both the gridviews are placed in an update panel.
following code called on gridview sorting and paging.
protected void gvSkills_PageIndexChanging(object sender, System.Web.UI.WebControls.GridViewPageEventArgs e)
{
try
{
// Set the index of the new display page.
gvSkills.PageIndex = e.NewPageIndex;
// Rebind the GridView control to
// show data in the new page.
BindSkillsGridView();
}
catch (Exception)
{
}
}
protected void gvSkills_Sorting(object sender, System.Web.UI.WebControls.GridViewSortEventArgs e)
{
try
{
string[] strSortExpression = ViewState["SortExpression"].ToString().Split(' ');
// If the sorting column is the same as the previous one,
// then change the sort order.
if (strSortExpression[0] == e.SortExpression)
{
if (strSortExpression[1] == "ASC")
{
ViewState["SortExpression"] = e.SortExpression + " " + "DESC";
}
else
{
ViewState["SortExpression"] = e.SortExpression + " " + "ASC";
}
}
// If sorting column is another column,
// then specify the sort order to "Ascending".
else
{
ViewState["SortExpression"] = e.SortExpression + " " + "ASC";
}
// Rebind the GridView control to show sorted data.
BindSkillsGridView();
}
catch (Exception)
{
}
}
I also tried putting the gridviews in diffrent update panels,but no luck.Any post pack on the page, I lose the pager control.
can you pleaes upload the HTML code as well and make sore the your styles files are properly linked with the html page.
thanks
hi,
In your BindSkillsGridView(); method you also need to bind another gridview .
try it again . if still have issue ,please let me know .
Hope this helps
沒有留言:
張貼留言