Binding doesn't happen automatically for template columns, you need to handle 
your own binding.  Have you created the DataBinding event as suggested by the 
article?  You can also manually handle the binding in the grid's ItemDataBound

event, which is not as elegant but works.

Why don't you post the code for DataGridTemplate.

HTH,

Dean Fiala
Very Practical Software, Inc.

http://www.vpsw.com

> 
> 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/html/
> 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
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 




------------------------ 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/
 

Reply via email to