Raj, Thanks for your reply. The second parameter I am passing is "ListItem.Text" ... that IS the column name in the table. Still not sure why it is not working. Ronda
_____ From: Rajendra Appalla [mailto:[EMAIL PROTECTED] Sent: Friday, August 27, 2004 12:00 PM To: [EMAIL PROTECTED] Subject: RE: [AspNetAnyQuestionIsOk] Dynamic Template Class Importance: High Hi Ronda, I did not quite understand the thing with the checkboxes in your code but, here is what I did: You assigned the dataset as the datasource to the datagrid as below: dgOrders.DataSource = DsCategories1.Tables("orders") The second parameter you should be passing to the DataGridTemplate class for the ListItemType.Item should be a column name in the datatable. Lets' say, Orders is a database table with a column OrderName. Then tc1.ItemTemplate = New DataGridTemplate(ListItemType.Item, "OrderName"); Hope this helps. Raj. -----Original Message----- From: Ronda [mailto:[EMAIL PROTECTED] Sent: Friday, August 27, 2004 11:56 AM To: [EMAIL PROTECTED] Subject: [AspNetAnyQuestionIsOk] Dynamic Template Class I am having a problem passing Data to a Template Class - the code for the template class I am using is similar to the code listed here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/h tml/ vbtskcreatingwebservercontroltemplatesdynamically.asp It is working fine but for some reason once it creates the template in the page I am not dynamically binding in other words the Grid is not populated with the data but with the text I passed. I feel like it is the order that I am approaching it. I am binding after the template is created but am getting the text I send to the template back as the value. If anyone can glance at this and offer a suggestion I would appreciate it. TIA ~ Ronda ------------------------------- My code below -------------------------------- Sub pullRecords(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim sql As System.String = "GetOrderDetails" Dim returnValue As System.Int32 Dim storeCode As String = txtProductCode.Text Dim begOrder As String = txtBegOrder.Text Dim endOrder As String = txtEndOrder.Text Dim conDB As New SqlConnection(Me.conString) conDB.Open() Dim cmdReturn As New SqlCommand(sql, conDB) cmdReturn.CommandType = CommandType.StoredProcedure 'Removed passing the parameters to the sproc Dim SqlDataAdapter1 As New SqlDataAdapter() SqlDataAdapter1.SelectCommand = cmdReturn Dim DsCategories1 As New DataSet() Dim ListItem As ListItem For Each ListItem In chkShow.Items 'Ideally I am checking the CHECKED checkboxes 'but right now I am just trying to get it to work at all Dim tc1 As New TemplateColumn() tc1.HeaderTemplate = New DataGridTemplate(ListItemType.Header, ListItem.Text) tc1.ItemTemplate = New DataGridTemplate(ListItemType.Item, ListItem.Text) tc1.FooterTemplate = New DataGridTemplate(ListItemType.Footer, ListItem.Text) dgOrders.Columns.Add(tc1) Next SqlDataAdapter1.Fill(DsCategories1, "orders") dgOrders.DataSource = DsCategories1.Tables("orders") dgOrders.DataBind() conDB.Close() conDB.Dispose() End Sub [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> $9.95 domain names from Yahoo!. Register anything. http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/