Ankur
Ankur

Reputation: 17

how to add a link button in the grid view by visual studio?

I want to add a link button in grid view that will navigate to the next form in the website. but i want to know how to insert that button into the grid view column? please help me..

Upvotes: 0

Views: 17917

Answers (4)

nunespascal
nunespascal

Reputation: 17724

You can add Link buttons in the Item template of a gridview.

<asp:TemplateField>
  <ItemTemplate>
    <asp:LinkButton ID="Link" runat="server" PostBackUrl="MyNextPage.aspx">Edit</asp:LinkButton>
  </ItemTemplate>
</asp:TemplateField>

Upvotes: 1

Abhijeetchindhe
Abhijeetchindhe

Reputation: 400

Make Sure your GridViews datasource is bound. Set Auto-Generate Columns to false. Open GridViewTask , add new column with Hyperlink Field proper name and path . You are done.

Upvotes: 0

user1102001
user1102001

Reputation: 707

try this

<asp:GridView ID="GridView1" runat="server">
            <Columns>
            <asp:ButtonField  ButtonType="Link" HeaderText="LinkButton"/>
            </Columns>
            </asp:GridView>

Upvotes: 0

Narendra
Narendra

Reputation: 3117

<Columns>
       <asp:TemplateField>
              <HeaderTemplate>
                   // TEXT FOR COLUMN NAME
              </HeaderTemplate>
              <ItemTemplate>
                    // ADD LINK BUTTON HERE.   
              </ItemTemplate>
        </asp:TemplateField>
  </Columns>

Add this inside grid view.

Upvotes: 0

Related Questions