PDA

View Full Version : [CLOSED] Grid Panel Column Headers - Special Characters



iansriley
Nov 27, 2012, 12:23 PM
Hi,

I have special characters in column headers of my Gridpanel. When we have "." in the column header, it is throwing a ext.net error. Have posted sample code below.


<!--Designer code-->
<ext:Store runat="server" ID="StData">
<Reader>
<ext:JsonReader>
<Fields>
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:GridPanel runat="server" StoreID="StData" ID="grdData" Height="400">
<ColumnModel>
<Columns>
</Columns>
</ColumnModel>
</ext:GridPanel>

<!--Code Behind-->
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim dt As New DataTable
dt.Columns.Add("A/B")
dt.Columns.Add("A%B")
dt.Columns.Add("Grand-Prix-of-St.-Petersb-2012")

Dim dr As DataRow = dt.NewRow()
dr(0) = "12.23"
dr(1) = "23.34"
dr(2) = "3"
dt.Rows.Add(dr)
For Each dCol As DataColumn In dt.Columns
StData.Reader(0).Fields.Add(dCol.ColumnName)
grdData.ColumnModel.Columns.Add(New GroupingSummaryColumn With {.SummaryType = SummaryType.Sum, .DataIndex = dCol.ColumnName, .Header = dCol.ColumnName})


Next


StData.DataSource = dt
StData.DataBind()
grdData.Reconfigure()
End If
End Sub

Is there any workaround for this issue or am I missing some property setting?

Thanks

RCN
Nov 27, 2012, 12:30 PM
Please wrap all code samples in [CODE] tags.

Forum Guidelines For Posting New Topics (http://forums.ext.net/showthread.php?3440)
More Information Required (http://forums.ext.net/showthread.php?10205)

RCN
Nov 27, 2012, 12:35 PM
It's not Column's Header, the problem is on DataIndex



DataIndex = dCol.ColumnName
Header = dCol.ColumnName

RCN
Nov 27, 2012, 12:40 PM
The Column's Header accepts special characters, as shown below:

5191

iansriley
Nov 27, 2012, 12:44 PM
So does that mean column dataIndex does not allow special characters? If not, is there a way out to assign that column header with special characters as DataIndex?


It's not Column's Header, the problem is on DataIndex



DataIndex = dCol.ColumnName
Header = dCol.ColumnName

RCN
Nov 27, 2012, 4:07 PM

Daniil
Nov 27, 2012, 4:29 PM
I would avoid special characters in DataIndex (i.e. in ModelField's Name).