CodeSmith Community
Your Code. Your Way. Faster!

Sorting, Paging and Hyperlink column with DataSet()

Latest post 02-26-2008 6:24 AM by doph. 2 replies.
  • 02-24-2008 5:45 AM

    • doph
    • Not Ranked
    • Joined on 02-23-2008
    • Posts 5
    • Points 140

    Sorting, Paging and Hyperlink column with DataSet()

    Fistly, on the good note, I just wanted to say that netTiers is really great and does save lots of work. However, there is one thing I can't handle and hope that the community can help figure this. I have done some searching and (my bad, possibly) can't find an easy solution for my problem.

    I am writing a little application, part of its functionality allows users search by user name and full name from profile. The user base is asp.net membership based and user's Full Name is part of user's profile. Asp.Net membership does not provide built-in tools for searching within user's profiles so I had to toss a dll for ms SQL assembly, wrap it with a couple of functions and a view.

    To cut this short, I ended up with a stored procedure that takes a string as an argument and returns list of users with this string entry in their user names and full names.

    What I do next, is I envoke this SP with:

    (DataSet)result = DataRepository.Provider.ExecuteDataSet("_cust_QueryProfiles_ByName", tb_searchString.Text);

    and then bind it to a GridView

    GridView1.DataSource = result;

    GridView1.DataBind();

     the GridView columns are as follows:

    <Columns>

    <asp:HyperLinkField HeaderText="NickName" DataTextField="UserName" SortExpression="UserName" />

    <asp:BoundField HeaderText="FullName" DataField="FullName" />

    <asp:BoundField HeaderText="DrinkerType" DataField="DrinkerTypeName" />

    </Columns>

    The questions I have are:

    how do I get the paging and sorting to work and how do I sort the HyperLinkField to point to a specific URI? (something like http://host.com/userview.aspx?UserName)

    Are there any methods/classes or generally, a better approach to get this?

    Many thanks for all your replies!

    • Post Points: 35
  • 02-24-2008 8:30 AM In reply to

    • mike123
    • Top 10 Contributor
    • Joined on 02-25-2005
    • Toronto, Ontario
    • Posts 735
    • Points 17,045

    Re: Sorting, Paging and Hyperlink column with DataSet()

    doph,

    This should help you to sort and page custom sp: http://community.codesmithtools.com/forums/p/4577/18699.aspx#18699 

    Use NavigateURL or DataNavigateUrlFields of your HyperLinkField to navigate url when it is clicked

    Mike Shatny
    --------------------------------------------------------------
    Member of the .netTiers team http://www.nettiers.com
    --------------------------------------------------------------

    • Post Points: 35
  • 02-26-2008 6:24 AM In reply to

    • doph
    • Not Ranked
    • Joined on 02-23-2008
    • Posts 5
    • Points 140

    Re: Sorting, Paging and Hyperlink column with DataSet()

    mike123,

     suggested solution with custom SP is quite "ditry" (at least this is how it looks to me). I am sure there should be a proper way to get this done.

    • Post Points: 5
Page 1 of 1 (3 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems