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["transactioni d"] to do some other tasks.
How to do that? Thanks
How to do that? Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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="CertificateHisto ry.ascx.cs " Inherits="UserControls_Cer tificateHi story" %>
<asp:SqlDataSource ID="SqlDataSource_Certific ateHistory " runat="server"
ConnectionString="<%$ ConnectionStrings:SqlDbCon nection %>"
SelectCommand="Certificate History" SelectCommandType="StoredP rocedure">
<SelectParameters>
<asp:SessionParameter Name="MemberId" SessionField="mid" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridViewCertificateHis tory" runat="server"
AutoGenerateColumns="False " CellPadding="4"
DataSourceID="SqlDataSourc e_Certific ateHistory " ForeColor="#333333"
GridLines="None" Width="800"
>
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:BoundField DataField="HolderFirstName " HeaderText="First Name"
SortExpression="HolderFirs tName" />
<asp:BoundField DataField="HolderLastName" HeaderText="Last Name"
SortExpression="HolderLast Name" />
<asp:BoundField DataField="ApplicationId" HeaderText="ApplicationId"
SortExpression="Applicatio nId" />
<asp:BoundField DataField="Created_Date" HeaderText="Created Date"
SortExpression="Created_Da te" />
<asp:BoundField DataField="CertificateStat usDescript ion"
HeaderText="Certificate Status"
SortExpression="Certificat eStatusDes cription" />
<asp:BoundField DataField="MemberId" Visible="false" HeaderText="MemberId"
SortExpression="MemberId" />
<asp:ButtonField />
<asp:TemplateField HeaderText="Option">
<ItemTemplate>
<a visible="true" target="_blank" href="CertificatePrint.asp x?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>
thanks
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CertificateHisto
<asp:SqlDataSource ID="SqlDataSource_Certific
ConnectionString="<%$ ConnectionStrings:SqlDbCon
SelectCommand="Certificate
<SelectParameters>
<asp:SessionParameter Name="MemberId" SessionField="mid" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridViewCertificateHis
AutoGenerateColumns="False
DataSourceID="SqlDataSourc
GridLines="None" Width="800"
>
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:BoundField DataField="HolderFirstName
SortExpression="HolderFirs
<asp:BoundField DataField="HolderLastName"
SortExpression="HolderLast
<asp:BoundField DataField="ApplicationId" HeaderText="ApplicationId"
SortExpression="Applicatio
<asp:BoundField DataField="Created_Date" HeaderText="Created Date"
SortExpression="Created_Da
<asp:BoundField DataField="CertificateStat
HeaderText="Certificate Status"
SortExpression="Certificat
<asp:BoundField DataField="MemberId" Visible="false" HeaderText="MemberId"
SortExpression="MemberId" />
<asp:ButtonField />
<asp:TemplateField HeaderText="Option">
<ItemTemplate>
<a visible="true" target="_blank" href="CertificatePrint.asp
</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>
Following link will provide you step-by-step instruction to implement the same scenario.
http://www.codeproject.com
Thanks,
NetSwap.