I can't figure out, how to enable sorting in dynamically created GridView placed in my Composite Control. Of course, I try to set property AllowSorting of GridView to "true", but it does not allow sorting functionality (there is no linkbutton in header on which I can click). AllowPaging property works just fine.
Any ideas how to resolve this?
protected override void OnInit(EventArgs e)
{
innerGridView.AutoGenerateColumns = false;
innerGridView.AllowSorting = true;
innerGridView.AllowPaging = true;
innerGridView.PageSize = 2;
base.OnInit(e);
}
I think the only visible problem is, that there is no LinkButton generated in GridView HeaderRow. So I bypass it by setting onclick attribute to every cell in HeaderRow.
Now I can click to header and sorting works. Of course, I will be glad if someone will come with better solution.