Link to home
Create AccountLog in
Avatar of heincpa
heincpa

asked on

HyperLinkField vs Button

How do I make

<asp:HyperLinkField Text="Select" DataNavigateUrlFields="nPDID"
  DataNavigateUrlFormatString="DetailsViewEdit.aspx?ID={0}" />    

look like

<asp:TemplateField ItemStyle-VerticalAlign="Top">
  <ItemTemplate>
    <asp:Button ID="gvSelectButton" CommandName="Select" Text="Select" Runat="Server" />
  </ItemTemplate>
</asp:TemplateField>  

or how to make a button that will call the same thing as the hyperlink field.

thanx
Avatar of pbocanegra
pbocanegra

the button is a server controls and triggered events. Usually, the hyperlink is a pointer to another place.
ASKER CERTIFIED SOLUTION
Avatar of Jason Scolaro
Jason Scolaro
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of heincpa

ASKER

Awesome...

and because I hate it when people just say thanx and don't post the final solution:

aspx page

                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Button CommandName="Select" CommandArgument='<%# Eval("nPDID") %>' Text="Select" runat="server"/>
                    </ItemTemplate>
                </asp:TemplateField>

code behind:

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Select")
        {

            Response.Redirect("DetailsViewEdit.aspx?ID=" + e.CommandArgument.ToString());
        }

    }

had to use tostring instead of CStr - VB vs C#

Thanx a bunch!