Technical support This forum is closed.
Version 1.x > Technical support > Custom Control View modes: 
User avatar
Guest
redactuk - 11/15/2006 6:46:58 PM
   
Custom Control
I want a custom control that lists some names from a custom table in the database. Using the instructions in the Developers Guide I succeded in doing this by including the BasicDataList on my custom control. This wroekd fine.. however:

1. Does this or any other CMS controls support a scroll box? i.e. I have about 50 names but only want my control to be the height of 5 diplsyaed at at time.

2. As an alternative to this I decided to try and use a standard VB2005 Listbox control. Now I'm only a novice programmer so please excuse my ignorance here, but does this standard VB controlhave to have its own connection string or can I use the existing VMS connection string?

I tried to do this but could not get the Listbox control to pickup the connection string as specified in the developers guide to be added in Page_Load:

Dim cn As New SqlConnection
cn.ConnectionString = ConfigurationSettings.AppSettings("CMSConnectionString")
Dim da As New SqlDataAdapter("SELECT * FROM Content_Product ORDER BY ProductName", cn)
Dim ds As New DataSet
da.Fill(ds)
BasicDataList1.DataSource = ds

I thought maybe all I needed to do was change last line to reference my list box i.e.

ListBox1.DataSource = ds

Any help appreciated!


User avatar
Guest
norashlea - 11/15/2006 7:21:31 PM
   
Re: Custom Control
You need to bind the dataset

..
BasicDataList1.DataSource = ds
BasicDataList.DataBind()