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

In GridTemplateColumn, how do I control the label that gets rendered?

2 Answers 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pavel
Top achievements
Rank 1
Pavel asked on 20 Jan 2016, 03:20 PM

I have the following two columns

 

<telerik:GridTemplateColumn HeaderText="Year" UniqueName="Year" Visible="False" Display="False">
    <EditItemTemplate>
        <asp:dropdownlist runat="server" id="ddlYear" appenddatabounditems="True">
            <asp:ListItem Text="-- Select Year --" Value="" />
        </asp:dropdownlist>
        <asp:requiredfieldvalidator ... />
    </EditItemTemplate>
</telerik:GridTemplateColumn>
 
<telerik:GridTemplateColumn HeaderText="Fund" UniqueName="Fund" Visible="False">
    <EditItemTemplate>
        <asp:listbox runat="server" id="lbFund" selectionmode="Multiple" />
        <asp:requiredfieldvalidator ... />
    </EditItemTemplate>
</telerik:GridTemplateColumn>

And here's the HTML output

 

<tr>
   <td>
      <label for="..._ddlReportPeriod">Budget Year:</label>   <!--LABEL-->
   </td>
   <td id="...">
      <select name="...>
         <option value="">-- Select Year --</option>
         ...
      </select>
</td>
</tr>
 
<tr>
   <td>
      Fund Source: <!--NOT A LABEL-->
   </td>
   <td id="...">
      <select size="4" ...>
         <option ...></option>
         ...
      </select>
</td>
</tr><tr>

How come in the first case, I get a <label> tag, but in the 2nd case I don't? Is there a way to fix this?

I trimmed the code as much as I could to make it readable.

2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 25 Jan 2016, 11:57 AM
Hi,

You can check which column type generates which control for its View Mode in the following table:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/columns/column-types#specific-properties-and-generated-controls

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Pavel
Top achievements
Rank 1
answered on 27 Jan 2016, 04:17 PM
Perfect, thank you!
Tags
Grid
Asked by
Pavel
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Pavel
Top achievements
Rank 1
Share this question
or