heincpa
asked on
HyperLinkField vs Button
How do I make
<asp:HyperLinkField Text="Select" DataNavigateUrlFields="nPD ID"
DataNavigateUrlFormatStrin g="Details ViewEdit.a spx?ID={0} " />
look like
<asp:TemplateField ItemStyle-VerticalAlign="T op">
<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
<asp:HyperLinkField Text="Select" DataNavigateUrlFields="nPD
DataNavigateUrlFormatStrin
look like
<asp:TemplateField ItemStyle-VerticalAlign="T
<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
the button is a server controls and triggered events. Usually, the hyperlink is a pointer to another place.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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(objec t sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
Response.Redirect("Details ViewEdit.a spx?ID=" + e.CommandArgument.ToString ());
}
}
had to use tostring instead of CStr - VB vs C#
Thanx a bunch!
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(objec
{
if (e.CommandName == "Select")
{
Response.Redirect("Details
}
}
had to use tostring instead of CStr - VB vs C#
Thanx a bunch!