-1

I am doing a project in which i am getting data from a database and displaying in asp:gridview. i want to show a hyperlink column in which i want to show a proper named hyperlink for example "View" and when the user click on "View" the data from the DataTextField property is displayed in detail on another page let say "WebForm1.aspx".i have searched on net and have studied on msdn bt couldnt get. detailed help will appreciated .. piece of code as example will be helpful . thanks in advance. Example: data in the database table NewsID NewsTitle NewsArticle (NewArticle field contains large amount of data)

i want to show a proper link named("view"). when user click on the view ,NewsArticle of the related record should be displayed in a new separate webpage.

4

2 回答 2

0

如果你熟悉 Jquery,你可以使用 Dialogs

http://jqueryui.com/dialog/

于 2013-06-10T18:16:21.843 回答
0

一种方法是让网格视图的每一行中包含的超链接/url 包含您要查看详细信息的记录的 id,即

<a href="webform1.aspx?id=12345">View</a>

然后在 webform1.aspx 的 page_load 事件中,您从数据库中检索该记录并将其显示在页面上。

给这只猫剥皮的方法有很多,这是一种比较简单的方法。下面的代码可以用来生成上面的 html:

    <asp:HyperLinkField HeaderText="Name" DataTextField="Id" DataNavigateUrlFields="DetailId" DataNavigateUrlFormatString="WebForm1.aspx?ID={0}">
    </asp:HyperLinkField>
于 2013-06-10T18:20:41.650 回答