Link to home
Start Free TrialLog in
Avatar of Webboy2008
Webboy2008

asked on

asp.net, gridview, button

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
Avatar of Swapnil
Swapnil
Flag of India image

Hi Webboy2008,

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

http://www.codeproject.com/Articles/14754/Popup-window-for-the-GridView

Thanks,
NetSwap.
ASKER CERTIFIED SOLUTION
Avatar of BuggyCoder
BuggyCoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Webboy2008
Webboy2008

ASKER

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

thanks

<%@ 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">
    <SelectParameters>
        <asp:SessionParameter Name="MemberId" SessionField="mid" Type="Int32" />
    </SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridViewCertificateHistory" runat="server"
    AutoGenerateColumns="False" CellPadding="4"
    DataSourceID="SqlDataSource_CertificateHistory" ForeColor="#333333"
    GridLines="None" Width="800"
    >
    <RowStyle BackColor="#EFF3FB" />
    <Columns>
        <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">
            <ItemTemplate>
             <a visible="true" target="_blank" href="CertificatePrint.aspx?id=<%# Eval("ApplicationId") %>" >
             Print
             </a>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    <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" />
</asp:GridView>