Donate

Append QueryString To PostBackUrl Attribute In ASP.NET Web Forms LinkButton Control Inside GridView Control

There was a question raised in the forum on how to append query string to a PostbackUrl attribute in an ASP.NET LinkButton inside the template field of a GridView control.

To answer that, one possible solution is to set the PostBackUrl with String.Format() method where you can include the desired query string of that url.
1
2
3
4
<asp:LinkButton ID="lnkProductPage" runat="server" 
    PostBackUrl='<%# String.Format("ProductPage.aspx?Id={0}", Eval("ID"))%>' 
    CausesValidation="false" Text='<%# Eval("ID")%>'>
</asp:LinkButton>

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

Bootstrap Modal In ASP.NET MVC With CRUD Operations