asp.net adding databound hyperlink columns to gridview programmatically
I indicated a GridView, around data in a table. The columns are bound. How did I become a certain column value an hyperlink? There is a possibility, instead of asp: BoundField, I could asp: I would populate hyperlink, but as?
Re: asp.net adding databound hyperlink columns to gridview programmatically
Here is the code as follows : Hope its Helpful
Code:
<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="White"
BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1"
GridLines="None" AutoGenerateColumns="False">
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
<RowStyle BackColor="#DEDFDE" ForeColor="Black" />
<PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
<Columns>
<asp:BoundField DataField="CategoryID" />
<asp:HyperLinkField DataNavigateUrlFields="CategoryID"
DataNavigateUrlFormatString="SmallWindow.aspx?id={0}"
DataTextField="CategoryName" NavigateUrl="SmallWindow.aspx" />
<asp:BoundField DataField="Description" />
</Columns>
</asp:GridView>
Re: asp.net adding databound hyperlink columns to gridview programmatically
With regard to the overall style I raccomandilo to use a file. Skin in the "Themes" folder of your ASP.NET 2.0 app. In this file the following Articles of GridView to CSS classes:
Code:
<asp:GridView SkinID="" runat="server" CellPadding="4" GridLines="Both" CssClass="GridView" Width="100%" BorderColor="#ECECEC" BorderStyle="Solid">
<HeaderStyle CssClass="GridHeader" />
<FooterStyle CssClass="GridFooter" />
<SelectedRowStyle CssClass="GridSelectedRow" />
<AlternatingRowStyle CssClass="GridAlternatingRow" />
<EditRowStyle CssClass="GridEditRow" />
<RowStyle CssClass="GridRow" />
<PagerStyle CssClass="GridPager" />
<EmptyDataRowStyle CssClass="GridEmptyRow" />
</asp:GridView>