DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 11 Jul 2007 21:12:21 +0200,    posted on: microsoft.public.dotnet.framework.aspnet.buildingcontrols        back       

Thread Index
  1    Robert Bevington


Building Dynamic Controls   
Hi everyone,
Can anyone point me in the right direction on this one?

I have a page with a GridView whose column names vary. On Page Load I 
search for specific columns (they can be identified by a prefix in the 
column name) and then want to create one or more drop-down list boxes 
depending on the number of columns. Each drop-down list box is to be 
associated to a column. The number and names of the columns is not fixed.

What's the best approach for dealing with this?

I'm trying a For Next Loop at the moment but cannot get the dynamic bits 
working. I get three drop-down lists.

<%--  Start Dynamic attribute field creation--%>

<%  For attCount = 1 To ATT_Columns.Count
     Dim ATT_Name As String = ATT_Columns(attCount)
%>

<asp:DropDownList ID="cboDept" runat="server" 
DataSourceID="SqlDataSource1" DataTextField="ATT_Department" 
DataValueField="ATT_Department" AppendDataBoundItems="True">

<asp:ListItem>Select from list</asp:ListItem>
</asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:Search4TextConnectionString %>"

SelectCommand="SELECT DISTINCT [ATT_Department] FROM NewTM2 ORDER BY 
ATT_Department"></asp:SqlDataSource>
<%  Next
%>

How can I replace, for example, ATT_Department with the variable ATT_Name

Any help would be great.

Thanks

Rob
Date:Wed, 11 Jul 2007 21:12:21 +0200   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us