Adding GridTemplateColumn breaks the RadGrid
Asked Answered
B

3

5

Looks like this before GridTemplateColumn:

enter image description here

And after adding GridTemplateColumn

<telerik:GridTemplateColumn HeaderText="Name" HeaderStyle-Width="250" FilterControlWidth="250">                          
    <ItemTemplate>                                          
        <asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#" Text='<%# Eval("Name") %>'></asp:HyperLink>
    </ItemTemplate>
</telerik:GridTemplateColumn>

enter image description here

Trying to implement http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx?product=tooltip

My RadGrid:

<telerik:RadGrid HorizontalAlign="Center" PageSize="50" ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" CellSpacing="0" AllowFilteringByColumn="false" Skin="Forest" DataSourceID="SqlDataSourceUyeAday" Height="400px" Width="100%" AutoGenerateColumns="False">
    <ClientSettings>
        <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
    </ClientSettings>
    <MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSourceUyeAday">
        <Columns>
            <telerik:GridBoundColumn ItemStyle-CssClass="iceri" DataField="Id" ItemStyle-Width="50" HeaderStyle-Width="50" FilterControlWidth="50" FilterControlAltText="Filter Id column" HeaderText="Id" SortExpression="Id" UniqueName="AdayId">
                <ColumnValidationSettings>

                </ColumnValidationSettings>
            </telerik:GridBoundColumn>

            <telerik:GridTemplateColumn HeaderText="FirstName" SortExpression="FirstName" DataField="FirstName" UniqueName="FirstName" FilterControlAltText="Filter FirstName column" HeaderStyle-Width="250" FilterControlWidth="250">

                <ItemTemplate>

                    <asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#" Text='<%# Eval("FirstName") %>'></asp:HyperLink>
                </ItemTemplate>
            </telerik:GridTemplateColumn>

            <telerik:GridDateTimeColumn DataField="Date" HeaderStyle-CssClass="iceriTarih" ItemStyle-CssClass="iceriTarih" FilterControlAltText="Filter Datecolumn" PickerType="DatePicker" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Date" SortExpression="Date" UniqueName="Date" DataType="System.DateTime" ItemStyle-Width="150" HeaderStyle-Width="150" FilterControlWidth="100">
                <ColumnValidationSettings>

                </ColumnValidationSettings>
            </telerik:GridDateTimeColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
</telerik:RadGrid>

What could be the reason?

Bennybenoit answered 20/7, 2014 at 8:1 Comment(0)
B
11

Apparently, this was required.

<appSettings>
   <add key="vs:EnableBrowserLink" value="false"/>
</appSettings>

From here: Telerik control layout issues - Visual Studio 2013

Bennybenoit answered 22/7, 2014 at 7:38 Comment(0)
S
0

Your code seems fine. You are using 'Name' as UniqueName and DataField. 'Name' is a reserved word and perhaps that is the reason you are seeing an unexpected behavior. Try to use some other names like 'FirstName' or 'LastName'

Stefaniastefanie answered 20/7, 2014 at 8:1 Comment(5)
Tried. Didn't make any difference.Bennybenoit
Sorry, you don't need to put DataField and UniqueName since you will assign value to the control using EVAL.Stefaniastefanie
Yes. It used to be like that. I thought adding them may help. Edited my answerBennybenoit
You should get rid of them.Stefaniastefanie
I don't have them. No difference!Bennybenoit
A
0
<telerik:GridTemplateColumn HeaderText="Status" HeaderStyle-Width="10%" ItemStyle-Width="10%"
    HeaderStyle-Font-Bold="true" UniqueName="Status" DataField='MstUserDefineCode.Code'>
                                <ItemTemplate>
                                    <asp:Label ID="LabelStatus" runat="server" Text='<%# Eval("ProjectStatus") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>

You can use Template Column like above code

Austronesia answered 21/7, 2014 at 8:49 Comment(1)
Question is not how to add gridtemplatecolumnBennybenoit

© 2022 - 2024 — McMap. All rights reserved.