Click here to Skip to main content
15,121,505 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,

i have a gridview bind with asp:template field columns i want to apply sorting on gridview columns.i have master pages also in my application.

when i apply sorting on gridview without master page then it work fine but when i apply master page then sorting doesnt work.
can anyone explain me the reason.

1 solution

Ok. Though you have not shared your sorting-implementation, I can guess out why it would be happening.

You failed to consider the master-child naming convention when master pages are used. Do a ViewSource of page and see - Check it!
If your code is working without master page, then you are able to find page control objects but when you use master page, you fail to find them and thus no sorting.

Next time, do share your code to get quick help.
miligupta123 15-May-12 1:53am
This is my Queryinfo.aspx page code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Queryinfo.aspx.cs" MasterPageFile="~/MasterPage.master" Inherits="_Queryinfo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script src="scripts/jquery-1.4.3.min.js" type="text/javascript"></script>

<script src="scripts/jquery.tablesorter.min.js" type="text/javascript"></script>

<script type="text/javascript">
function pageLoad(sender, args)

<asp:Content ID="BodyContent" runat="server"ContentPlaceHolderID="ContentPlaceHolder1">
---- here my gridview code --------

This is i added in Queryinfo.aspx.cs page

grdQueryinfo.UseAccessibleHeader = true;
grdQueryinfo.HeaderRow.TableSection = TableRowSection.TableHeader;
grdQueryinfo.FooterRow.TableSection = TableRowSection.TableFooter;

please explain me whats the problem.
Sandeep Mewara 15-May-12 12:09pm
Do a viewsource, see if the ID name you passed is correct or not.

You used #selector. Try to use CSS selector, that might avoid this naming convention issues.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900