Skip to content Skip to sidebar Skip to footer

Hyperlink To Retrieve Data From A Database In Asp.net

I am developing job portal which displays different jobs stored in database (SQL Server). I am using ASP.NET and HTML. I have job_title and unique job_id in database table. I have

Solution 1:

It looks like you wanna have urls like this:

blabla-your-website.com/fisrt-job-title
blabla-your-website.com/second-job-title
blabla-your-website.com/other-job-title

But you said:

job_title is not unique, but job_id is

So it's not possible to do. The common solution for this is to use ids and titles at the same time in your url:

blabla-your-website.com/1-fisrt-job-title
blabla-your-website.com/22-second-job-title
blabla-your-website.com/333-other-job-title

Where 1, 22, and 333 are unique ids for particular job.

If your titles are unique, it's quite easy to do. Take a look at RacoonBlog's SlugConverter. It is used to convert your titles to urls like this (code from RacoonBlog tests):

        var result= SlugConverter.TitleToSlug("Document based modeling: Auctions & Bids");
        Assert.Equal("document-based-modeling-auctions-bids", result);

        result= SlugConverter.TitleToSlug("Hiring Questions–The phone book");
        Assert.Equal("hiring-questions-the-phone-book", result);

Post a Comment for "Hyperlink To Retrieve Data From A Database In Asp.net"