, gridview, button

Webboy2008 used Ask the Experts™
have a working c# gridview, and now want to add a button and when the button is clicked, it will open up new window and carry one parameter, like transactionid so the new page can use request.form["transactionid"] to do some other tasks.

How to do that? Thanks
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
SwapnilSoftware Architect
Top Expert 2005

Hi Webboy2008,

        Following link will provide you step-by-step instruction to implement the same scenario.



I end up creating <a href> and it works. but the question is how it hides 'print' when  the applicationid = '1' for example.


<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CertificateHistory.ascx.cs" Inherits="UserControls_CertificateHistory" %>
<asp:SqlDataSource ID="SqlDataSource_CertificateHistory" runat="server"
    ConnectionString="<%$ ConnectionStrings:SqlDbConnection %>"
    SelectCommand="CertificateHistory" SelectCommandType="StoredProcedure">
        <asp:SessionParameter Name="MemberId" SessionField="mid" Type="Int32" />
<asp:GridView ID="GridViewCertificateHistory" runat="server"
    AutoGenerateColumns="False" CellPadding="4"
    DataSourceID="SqlDataSource_CertificateHistory" ForeColor="#333333"
    GridLines="None" Width="800"
    <RowStyle BackColor="#EFF3FB" />
        <asp:BoundField DataField="HolderFirstName" HeaderText="First Name"
            SortExpression="HolderFirstName" />
        <asp:BoundField DataField="HolderLastName" HeaderText="Last Name"
            SortExpression="HolderLastName" />
        <asp:BoundField DataField="ApplicationId" HeaderText="ApplicationId"
            SortExpression="ApplicationId" />
        <asp:BoundField DataField="Created_Date" HeaderText="Created Date"
            SortExpression="Created_Date" />
        <asp:BoundField DataField="CertificateStatusDescription"
            HeaderText="Certificate Status"
            SortExpression="CertificateStatusDescription" />            
        <asp:BoundField DataField="MemberId" Visible="false" HeaderText="MemberId"
            SortExpression="MemberId" />
        <asp:ButtonField   />
        <asp:TemplateField HeaderText="Option">
             <a visible="true" target="_blank" href="CertificatePrint.aspx?id=<%# Eval("ApplicationId") %>" >
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <EditRowStyle BackColor="#2461BF" />
    <AlternatingRowStyle BackColor="White" />

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial