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. Image for the cookie policy date

Can't use slash on headerText on Unbounded column

I have a grid in my aspx file like this:

              <ej:Grid ID="dgManager" runat="server" AllowFiltering="false" AllowPaging="True" AllowGrouping="false" AllowSorting="true" AllowReordering="true"  >
                    <Columns>
                        <ej:Column Field="Agent1" HeaderText="Main Office"  Width="70" />
                        <ej:Column Field="Agent2" HeaderText="Sub Office"  Width="70" />
                        <ej:Column Field="Status" HeaderText="Status" Width="110"/>
                        <ej:Column Field="VIPP" HeaderText="VIP" Width="50"/>
                        <ej:Column HeaderText="View/Edit" IsUnbound="True" TextAlign="Center" Width="150">
                            <Commands>
                                <ej:Commands Type="detail">
                                    <ButtonOptions Text="View/Edit" Width="100" Click="View" ></ButtonOptions>
                                </ej:Commands>
                            </Commands>
                        </ej:Column>                      
                    </Columns>
                </ej:Grid>

When I use a slash in the column "View/Edit", the grid just doesn't populate. If I use a slash in any other of the columns headerText, it works. I think it is because it is an unbounded column.  
I want the HeaderText to be "View/Edit", with the slash. I have already tried escaping the character, but it doesn't work. Any ideas?

3 Replies

BM Balaji Marimuthu Syncfusion Team October 9, 2015 08:46 AM UTC

Hi Constanza,

Thanks for using Syncfusion Products.

To achieve your requirement, we suggest you to use the HeaderTemplateID property in Grid columns. Refer to the sample and code example below.
Sample


<ej:Grid ID="FlatGrid" runat="server" AllowSorting="True" AllowPaging="True" ClientIDMode="Static" >

            <ClientSideEvents ActionComplete="complete" />

            <Columns>

                <ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="True" TextAlign="Right" Width="75" />

                <ej:Column Field="CustomerID" HeaderText="Customer ID" Width="80" />

                <ej:Column Field="EmployeeID" HeaderText="Employee ID" TextAlign="Right" Width="75" />

                <ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="75" Format="{0:C}" />

                <ej:Column HeaderText="View Edit" HeaderTemplateID="#employeeTemplate"  IsUnbound="True" TextAlign="Center" Width="150">

                     <Command>

                             <ej:Commands Type="detail">

                                 <ButtonOptions Text="View/Edit" Width="100" Click="View" ></ButtonOptions>

                             </ej:Commands>

                      </Command>

                </ej:Column>   

            </Columns>

           
        </ej:Grid>


<script id="employeeTemplate" type="text/x-jsrender">

        View/Edit
    </script>


Refer to the Online Demo in following link: http://asp.syncfusion.com/demos/web/grid/headertemplate.aspx


Regards,
Balaji Marimuthu


CO Constanza October 9, 2015 12:51 PM UTC

That worked perfectly!! Thank you very much!


BM Balaji Marimuthu Syncfusion Team October 12, 2015 05:21 AM UTC

Hi Constanza,

We are happy that provided solution helped you.

Please get back to us if you need further assistance. we will be happy to assist you.

Regards,
Balaji Marimuthu

Loader.
Live Chat Icon For mobile
Up arrow icon