ok the following is the code for the gridview:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BorderColor="#3399FF" BorderStyle="Solid" CellPadding="10" CellSpacing="10"
DataKeyNames="Request_No" DataSourceID="SqlDataSource1" ForeColor="#3399FF"
HorizontalAlign="Center">
<Columns>
<asp:BoundField DataField="Request_No" HeaderText="Request No" ReadOnly="True"
SortExpression="Request_No" />
<asp:BoundField DataField="Request_Details" HeaderText="Request Details"
SortExpression="Request_Details" />
<asp:BoundField DataField="Request_Status" HeaderText="Request Status"
SortExpression="Request_Status" />
</Columns>
</asp:GridView>
I have the three columns, and I want the last column cell data 开发者_运维百科to be hyperlinks. So when I press that link, it will go to another page so that I could retrieve the cell value there and call details of request from database. This is simple enough in PHP but here am not sure how :( Thanks and help is appreciated :)
To do it you need to use TemplateField instead of <asp:BoundField DataField="Request_Status"
something like:
<asp:TemplateField>
<ItemTemplate>
<a href="requiredUrl">link text</a>
</ItemTemplate>
</asp:TemplateField>
In order to get data binding in that template you can use Bind, Eval methods
Maybe you want to try this one.
http://www.aspexception.com/resourcedepot/howto_gridviewurl.aspx
精彩评论