Jan 22, 2013, 12:12 PM
[CLOSED] Dynamically created TemplateColumn and template not script not rendered correctly.
Hello,
I am dynamically building a grid adding columns based on a configuration. This worked like a charm until today, when we had the requirement to add some <TemplateColumn/> columns too.
The grid is on the ASPX page with a "base" markup that is changed server-side by adding the columns, properties, and so on.
The TemplateColumn is configured by setting the "Column.Template.Html" property to the required template:
For the sake of a test we put a sample string right now "<div>Test</div>".
... {dataIndex:"c2",header:"Subject",id:"Subject",widt h:-1,xtype:"templatecolumn",tpl:{body_ctl09_ClientInit}} ...
However, that client side script "body_ctl09_ClientInit" is not found at all...
It appears that "ClientInit" scripts are not rendered at all.
Is there a special process to add columns at server side so that client init scripts are dumped to the client?
Thank you!
I am dynamically building a grid adding columns based on a configuration. This worked like a charm until today, when we had the requirement to add some <TemplateColumn/> columns too.
The grid is on the ASPX page with a "base" markup that is changed server-side by adding the columns, properties, and so on.
The TemplateColumn is configured by setting the "Column.Template.Html" property to the required template:
For the sake of a test we put a sample string right now "<div>Test</div>".
' add column on grid.
Dim cfg As Ext.Net.Column.Config
Dim c As Ext.Net.Column
If col.Template IsNot Nothing Then
' template column.
cfg = New Ext.Net.TemplateColumn.Config()
Else
' normal column.
cfg = New Ext.Net.Column.Config()
End If
' configure standard column properties.
With cfg
.ColumnID = col.ID
.DataIndex = String.Format("c{0}", col.Index)
.Width = col.Width
.Header = col.Description
.Hidden = Not col.Visible
End With
If col.Template IsNot Nothing Then
' template column.
Dim templateColumn = New Ext.Net.TemplateColumn(cfg)
templateColumn.Template.Html = "<div>test</div>"
c = templateColumn
Else
c = New Ext.Net.Column(cfg)
End If
Unfortunately when we run the application we are not able to see anything and we saw a Javascript error that, very clearly state that the "tpl" property is mapped to a "javascript" clientinit function that's not present on the page:... {dataIndex:"c2",header:"Subject",id:"Subject",widt h:-1,xtype:"templatecolumn",tpl:{body_ctl09_ClientInit}} ...
However, that client side script "body_ctl09_ClientInit" is not found at all...
It appears that "ClientInit" scripts are not rendered at all.
Is there a special process to add columns at server side so that client init scripts are dumped to the client?
Thank you!
Last edited by Daniil; Jan 25, 2013 at 7:27 AM.
Reason: [CLOSED]