• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

select first item in a gridview

Hey guys i need to get the first item in my gridview, which is a hyperlink and make the hyper link class to avtive.

here my aspx page:

 
<asp:GridView ID="GridView" runat="server" GridLines="None" ShowHeader="False" AutoGenerateColumns="False" HorizontalAlign="Center">
                                    <Columns>
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <table cellpadding="0" cellspacing="0" style="width: 210px;">
                                                    <tr>
                                                        <td class="middle">
                                                            <asp:HyperLink ID="HyperLink" runat="server" ToolTip='<%# Bind("title") %>' Text='<%# Bind("short_title") %>' NavigateUrl='<%# Eval("id", "~/Projects.aspx?id={0}") %>'></asp:HyperLink>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>

Open in new window


i need c# code please...

i am binding my gridview with c# code.
0
JCWEBHOST
Asked:
JCWEBHOST
1 Solution
 
Kiran SonawaneProject LeadCommented:
You can get it like this

HyperLink link = (HyperLink) GridView.Rows[0].FindControl("HyperLink");

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now