How to create dynamic links from a database

I am able to pull a list of stories from a database, however, I want to pull a list of stories and link to the page that displays the story.  For example I want to list the story title and have the story title be a link that links to page that displays a story based on the story ID.  

I can display the list of stories, and I have a page that will display the story based on an ID, however, how to I create the link for the title?

<a href="story.aspx?ID='storyID'>Story Title</a>

That is what I am trying todo.  

Thank you for any advice.  I am using c# with SQL server back end.
shanemayAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

the_bachelorCommented:
Well a real rudimental way is to have
1. a Table (say tblStory with Columns StoryID, Title, Body)
2. you have maye a stored procedure that takes a storyID as a parameter and retrieves the table row associated with the ID
3. on the Story.aspx you have place holders to display the Title and the body.
0
M3mph15Commented:
Hi,
What i could do is use a repeater and bind to it an SqlDataSource that retrieves Story ID and Stroy Title.
SqlDataSource would have a Select statemnt like "SELECT STORY_ID, STORY_NAME FROM STORY".

<asp:Repeater ID="repParty" runat="server" DataSourceID="SqlDataSource1">
        <ItemTemplate>
                 <a href="<%FormatUrl(DataBinder.Eval(Container.DataItem, "STORY_ID")) %>"><%#DataBinder.Eval(Container.DataItem, "STORY_NAME")%></a>
        </ItemTemplate>
</asp:Repeater>

And then in the code behind file put this function:
public string FormatUrl(string id)
{
    string url = "story.aspx?ID=" + id;
    return url;
}

Hope This Helps
-M3mph15
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shanemayAuthor Commented:
Thank you for the help, with a little bit of modification that worked excatly like I needed it to.  I really appericiate your help.  Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.