This is a migrated thread and some comments may be shown as answers.

Item Template using a label does not render tabs

1 Answer 128 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Laura
Top achievements
Rank 1
Laura asked on 12 May 2009, 07:55 PM
I have a grid with gridtemplatecolumns and each column has an item template of a label and and edit template of a textbox. HEre is my column:
<telerik:GridTemplateColumn DataField="contact_name" HeaderText="Contact Name"  
                                            UniqueName="contact_name"
    <ItemTemplate> 
      <asp:Label ID="Label1" runat="server"  Text='<% #Eval("contact_name") %>'</asp:Label>                                     
                                      
   </ItemTemplate> 
    <EditItemTemplate> 
      <asp:TextBox ID="contact_name" runat="server" Text='<%#Eval("contact_name") %>'  Width="200px"></asp:TextBox> 
        <font color="blue">*</font> 
          <asp:RequiredFieldValidator ID="contactnameRequiredFieldValidator"  
                runat="server" ControlToValidate="contact_name"  Display="Dynamic"                                                    ErrorMessage="required"></asp:RequiredFieldValidator> 
     </EditItemTemplate> 
 </telerik:GridTemplateColumn> 

 The data it is retrieving has a tab in it, so for example "contact_name" is made up of first_name last_name (tab) contact_type
and in the edititemtemplate textbox, the tab is there, but in the label, the tab is not there. Does labels render tabs? And if not, is there another control I can use for the ItemTemplate to show the tabs?

Thanks,
Laura

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 14 May 2009, 08:07 AM
Hello Laura,

The default browser behavior is to treat any kind of empty space in the HTML output ("spacebar space", new line, tab, etc) or a number of consecutive empty spaces as one "spacebar space". In order to change this, you should use the white-space CSS style or the pre HTML element

white-space CSS property

pre HTML element

Note that the <pre> element has a predefined font styles, so you may want to add some custom font styles with external CSS or a sttyle tag, e.g.

pre
{
       font:12px arial,sans-serif;
}

or

<ItemTemplate>
     <pre style="font:12px arial,sans-serif"><asp:Label .... /></pre>
</ItemTemplate>


Sincerely yours,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Laura
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or