?
Solved

Bound Column or Template Column

Posted on 2005-02-28
4
Medium Priority
?
334 Views
Last Modified: 2008-02-07
After reading, I still don't understand the differences bettween a bound column and a template column.

Could someone please name a few key differences in these two types of columns?

Thanks in advance,
0
Comment
Question by:Weller0123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 10

Accepted Solution

by:
NetDeveloper earned 500 total points
ID: 13424614
basically, if you want to have <html> elements (runat=server or not ) and or <asp: tags inside a column of your DataGrid you have to use template columns.

bound colums are, instead ok, when u don't want to include in your Grid those elements

you can also use just one template colum to have a datagrid with any kind of html layout.
0
 
LVL 13

Assisted Solution

by:davidlars99
davidlars99 earned 500 total points
ID: 13425754
this is code which make "BoundColumn" work

Public Class BoundColumn
      Inherits DataGridColumn

      ' Methods
      Shared Sub New()
      Public Sub New()
      Protected Overridable Function FormatDataValue(ByVal dataValue As Object) As String
      Public Overrides Sub Initialize()
      Public Overrides Sub InitializeCell(ByVal cell As TableCell, ByVal columnIndex As Integer, ByVal itemType As ListItemType)
      Private Sub OnDataBindColumn(ByVal sender As Object, ByVal e As EventArgs)

      ' Properties
      <WebCategory("Data"), WebSysDescription("BoundColumn_DataField"), DefaultValue("")> _
      Public Overridable Property DataField As String
      <DefaultValue(""), WebCategory("Behavior"), WebSysDescription("BoundColumn_DataFormatString")> _
      Public Overridable Property DataFormatString As String
      <WebSysDescription("BoundColumn_ReadOnly"), WebCategory("Behavior"), DefaultValue(False)> _
      Public Overridable Property [ReadOnly] As Boolean

      ' Fields
      Private boundField As String
      Private boundFieldDesc As PropertyDescriptor
      Private boundFieldDescValid As Boolean
      Private formatting As String
      Public Shared ReadOnly thisExpr As String
End Class



and this is the for "TemplateColumn"

Public Class TemplateColumn
      Inherits DataGridColumn

      ' Methods
      Public Sub New()
      Public Overrides Sub InitializeCell(ByVal cell As TableCell, ByVal columnIndex As Integer, ByVal itemType As ListItemType)

      ' Properties
      <DefaultValue(CType(Nothing,String)), TemplateContainer(GetType(DataGridItem)), Browsable(False), WebSysDescription("TemplateColumn_EditItemTemplate"), PersistenceMode(PersistenceMode.InnerProperty)> _
      Public Overridable Property EditItemTemplate As ITemplate
      <WebSysDescription("TemplateColumn_FooterTemplate"), DefaultValue(CType(Nothing,String)), PersistenceMode(PersistenceMode.InnerProperty), TemplateContainer(GetType(DataGridItem)), Browsable(False)> _
      Public Overridable Property FooterTemplate As ITemplate
      <TemplateContainer(GetType(DataGridItem)), WebSysDescription("TemplateColumn_HeaderTemplate"), PersistenceMode(PersistenceMode.InnerProperty), Browsable(False), DefaultValue(CType(Nothing,String))> _
      Public Overridable Property HeaderTemplate As ITemplate
      <TemplateContainer(GetType(DataGridItem)), DefaultValue(CType(Nothing,String)), PersistenceMode(PersistenceMode.InnerProperty), Browsable(False), WebSysDescription("TemplateColumn_ItemTemplate")> _
      Public Overridable Property ItemTemplate As ITemplate

      ' Fields
      Private editItemTemplate As ITemplate
      Private footerTemplate As ITemplate
      Private headerTemplate As ITemplate
      Private itemTemplate As ITemplate
End Class

0
 
LVL 26

Assisted Solution

by:Rejojohny
Rejojohny earned 500 total points
ID: 13426784
when u want the grid to be used just for displaying data and not interactive i.e. no textboxes, checkbox etc .. then u will use bound columns for those columns
but when u want to accept data, ask user to input data using a dropdown etc .. then u will have to use template columns and then add these webcontrols that u require within these template columns ..

take the example of an "inbox" page in hotmail or for that matter most of the mail sites .. the list of mails could be displayed by using a datagrid with the first column where there is checkbox to select the mail, u would have to use a template column and add a checkbox within it .. but for the other columns like the description, date etc, u could just use a bound column
0
 
LVL 11

Assisted Solution

by:saleek
saleek earned 500 total points
ID: 13429010
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question