We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dynamically add template columns

Thread ID:

Created:

Updated:

Platform:

Replies:

70169 Nov 29,2007 03:29 PM UTC Dec 3,2007 12:05 PM UTC ASP.NET Web Forms (Classic) 4
loading
Tags: GridGroupingControl
Vinay Singh
Asked On November 29, 2007 03:29 PM UTC

Hi Friends,

How can i add dynamically add template columns to essential grid so that i can have a grid where all the rows are editable?


Kathy Gray
Replied On November 29, 2007 08:07 PM UTC

Hi, I have just discovered how to do this, so I pass it on... You can create them similar to how you do with regular Gridview (see http://www.codeproject.com/useritems/create_template_columns.asp). Using that as an example, you would change "TemplateField bfield = new TemplateField();", to "GridColumnDescriptor bfield = new GridColumnDescriptor();", and "GridViewRow container = (GridViewRow)txtdata.NamingContainer;" to "GridCellTemplated Container = (GridCellTemplated) txtdata.NamingContainer"
ie: Use GridColumnDescriptor where it says TemplateField, and user GridCellTemplated where it says GridViewRow. Other than that, it's the same basic concept.

>Hi Friends,

How can i add dynamically add template columns to essential grid so that i can have a grid where all the rows are editable?




Kathy Gray
Replied On November 29, 2007 08:07 PM UTC

Hi, I have just discovered how to do this, so I pass it on... You can create them similar to how you do with regular Gridview (see http://www.codeproject.com/useritems/create_template_columns.asp). Using that as an example, you would change "TemplateField bfield = new TemplateField();", to "GridColumnDescriptor bfield = new GridColumnDescriptor();", and "GridViewRow container = (GridViewRow)txtdata.NamingContainer;" to "GridCellTemplated Container = (GridCellTemplated) txtdata.NamingContainer"
ie: Use GridColumnDescriptor where it says TemplateField, and user GridCellTemplated where it says GridViewRow. Other than that, it's the same basic concept.

>Hi Friends,

How can i add dynamically add template columns to essential grid so that i can have a grid where all the rows are editable?




Vinay Singh
Replied On November 30, 2007 06:39 AM UTC

Thanks kathy but i was looking forward to a VB.Net code for it and not C#.Can you help me with this?






Rajarajeswari S [Syncfusion]
Replied On December 3, 2007 12:05 PM UTC


Hi Vinay,

Thanks for using Syncfusion products:

You can have Template columns by creating separate Template Class. Please refer the below code snippet which illustrates to create template column:

If e.TableCellIdentity.Column.Name = "Column2" Then
Dim dropdown As Syncfusion.Web.UI.WebControls.Tools.DropDownCalendarControl = New DropDownCalendarControl()
'Here we adding the DropDownListBox programatically using ITemplate Interface
Dim mytemp As TemplateClass = New TemplateClass(dropdown)
e.TableCellIdentity.Column.EditItemTemplate = mytemp
End If
Public Class TemplateClass : Implements ITemplate
Private m_ctrlChildControl As Control = Nothing
Public Sub New(ByVal ctrlChildControl As Control)
m_ctrlChildControl = ctrlChildControl
End Sub
Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn
container.Controls.Add(m_ctrlChildControl)
End Sub
End Class

Please refer the sample from the below link which illustrates the above:

http://websamples.syncfusion.com/samples/grid.web/5.2.0.25/i38780/main.htm

Please let me know if this helps you out.

Regards,
Raji



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;