Results 1 to 3 of 3

Thread: asp.net adding databound hyperlink columns to gridview programmatically

  1. #1
    Join Date
    Mar 2009
    Posts
    37

    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?

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    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>

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    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>

Similar Threads

  1. Adding an Attachment to a List Item Programmatically in SharePoint
    By bijayani in forum Software Development
    Replies: 2
    Last Post: 30-06-2010, 12:06 PM
  2. Replies: 2
    Last Post: 09-09-2009, 09:40 PM
  3. Programmatically add a database
    By Zool in forum Software Development
    Replies: 2
    Last Post: 19-05-2009, 09:08 PM
  4. Add Columns to GridView Programmatically
    By Firon in forum Software Development
    Replies: 3
    Last Post: 19-05-2009, 06:44 PM
  5. Free SMS Server to send SMS programmatically
    By Cavan in forum Networking & Security
    Replies: 3
    Last Post: 16-05-2009, 08:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,506,468.28483 seconds with 17 queries