How to make a hyperlink through GridView column value?

Posted by avirk on Stack Overflow See other posts from Stack Overflow or by avirk
Published on 2011-11-10T15:05:53Z Indexed on 2012/11/13 11:02 UTC
Read the original article Hit count: 339

Filed under:
|
|

enter image description here

I want here that user can see the answer under the question by selecting its heading. The question should be a hyperlink to redirect me on the page Answer.aspx. I mean to say that when user take cursor over the How to do this? it should redirect the user to the desired page. How can I do that?

here is the code

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
       DataSourceID="SqlDataSource1" Width="100%" BorderStyle="None">
       <Columns>  
     <asp:BoundField DataField="QuestionHEAD" HeaderText="Question"
                                        SortExpression="QuestionHEAD" HeaderStyle-ForeColor="white" HeaderStyle-BackColor="Brown"/>
                                    <asp:BoundField DataField="Problem" HeaderText="Problem" 
                                        SortExpression="Problem" HeaderStyle-ForeColor="white" HeaderStyle-BackColor="Brown" />
                                    <asp:BoundField DataField="Forum" HeaderText="Forum" SortExpression="Forum" HeaderStyle-ForeColor="white" HeaderStyle-BackColor="Brown"/>
                                    <asp:BoundField DataField="Username" HeaderText="Asked By" 
                                        SortExpression="Username" HeaderStyle-ForeColor="white" HeaderStyle-BackColor="Brown" />
                                </Columns>
                            </asp:GridView>
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:connectionstring %>" 
                                SelectCommand="SELECT [QuestionHEAD], [Problem], [Forum], [Username] FROM [Question]">
                            </asp:SqlDataSource>

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET