Wrox Programmer Forums
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 7th, 2005, 10:31 AM
Authorized User
Join Date: Oct 2003
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Default databound headertemplate


I am binding a datalist from sql. In sql i have a table with the following fields:
prodID,ProductName, CategoryName

I want my datalist to look as follows (but it doesn't):
CategoryNameA =Header
Product 1 =ItemTemplate
Product 2
CategoryNameB=Headertemplate (from database)
Product 3 =ItemTemplate
Product 4

However, I get the following result:
CategoryNameA =Header
Product 1 =ItemTemplate
Product 2
Product 3
Product 4

I have a datalist such as the following:
<asp:datalist id="PicList" runat="server" Font-Names="Arial" Font-Size="Smaller">
<%# dt.Rows(0).Item( "CategoryName") %>
<TD dir='rtl' valign="top">
<%# ImgExist(Container.DataItem("ProductName")) %>

 Dim cmd As SqlCommand

        cmd = objConn.CreateCommand


        Dim da As New SqlDataAdapter(cmd)

        dt = New DataTable("ads")


        If dt.Rows.Count = 0 Then

            PicList.Visible = False

        Else : PicList.Visible = True

        End If

        PicList.DataSource = dt


Similar Threads
Thread Thread Starter Forum Replies Last Post
Databound Dropdown fullingdale ASP.NET 2.0 Basics 2 June 20th, 2008 02:33 AM
Getting a databound value from datalist contrrol almotions ASP.NET 2.0 Basics 8 April 23rd, 2008 09:00 AM
Findcontrol in headertemplate of datagrid S_Dogra ASP.NET 1.0 and 1.1 Professional 1 January 4th, 2007 03:41 AM
findcontrol in a headertemplate of datagrid S_Dogra ASP.NET 1.0 and 1.1 Basics 0 December 28th, 2006 02:52 AM
VS2005 DataGridViewComboBoxColumn databound CloudDust Visual Basic 2005 Basics 4 October 12th, 2006 06:29 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.