Friday, 6 May 2011

GridView: Get the website link from Database

<asp:GridView ID="grid" runat="server" DataKeyNames="WebsiteID" Width="100%"
    AutoGenerateColumns="False">
    <Columns>
        <asp:TemplateField HeaderText="Website Descriptions"
            SortExpression="Descriptions">
            <EditItemTemplate>
                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Descriptions") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# Bind("Descriptions") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:HyperLinkField DataNavigateUrlFormatString="" 
            DataTextField="Link" HeaderText="Website Link" DataNavigateUrlFields="Link" Target="_blank" />
    </Columns>
</asp:GridView>

No comments:

Post a Comment