0

I am developing a custom grid view control. with paging, searching, sorting now I need to write one common function for sorting, searching in different class file

In sorting i am trying to use this function

public SortDirection GridViewSortDirection
{
    get
    {
        if (ViewState["sortDirection"] == null)
            ViewState["sortDirection"] = SortDirection.Ascending;

        return (SortDirection)ViewState["sortDirection"];
    }
    set { ViewState["sortDirection"] = value; }

}

but in c# class file we don't have a viewstate properties. So how can i solve this issue?

If I write one function common for sorting in a class file so that iI can use in all the pages of the gridview where sorting is required.

Any help on this issue would be great.

Thank you.

2
  • 2
    How is it even possible to ask 19 questions and not mark a single answer? =) Commented Sep 23, 2009 at 11:16
  • Can you imagine the world of hurt this guy is setting himself up for? Commented Sep 23, 2009 at 11:55

1 Answer 1

1

If your control inherit from System.Web.UI.Control, you have access to a protected ViewState property.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.