Adding Link Column to ASP.NET GridView

前端 未结 5 2112
一向
一向 2020-12-30 01:00

I want to output a list of news headlines that are clickable. So far I can get it to print out a list of headlines because I dragged and dropped the NewsHeadline table in d

5条回答
  •  再見小時候
    2020-12-30 01:32

    You need to change the column type from a BoundColumn to a Hyperlink column.

       
    

    In addition to making this change, you'll need to make sure that you are selecting the URL or something you can use to create the link to the news article. In the example above, I'm assuming the URL is something you can grab from your SQL source. If it is an ID, simply type out the rest of the url like this... "~/MyNewsPage.aspx?NewsID={0}"...

提交回复
热议问题