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

Data displayed wrongly when using templates

4 Answers 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Khan
Top achievements
Rank 2
Khan asked on 03 Dec 2013, 01:53 AM
Whenever Template is used in grid data is displayed wrongly on checking the page found that the <table> ,<tr>,<td> elements are missing
If I use Inplace edit the grid is displayed correctly.





<telerik:RadGrid ID="gvCountry" runat="server" CssClass="RadGrid" GridLines="None" ShowFooter="True" ShowStatusBar="True" CellSpacing="0" VirtualItemCount="100000"

PageSize="20" AllowPaging="True" AllowCustomPaging="true" AlternatingItemStyle-BackColor="#FEE4EFFF" AutoGenerateColumns="False" AllowSorting="True"

AllowFilteringByColumn="True" OnInsertCommand="gvCountry_ItemInserted" OnUpdateCommand="gvCountry_ItemUpdated" OnDeleteCommand="gvCountry_ItemDeleted"

OnItemDataBound="gvCountry_ItemDataBound" OnItemCreated= "gvCountry_ItemCreated" OnItemCommand="gvCountry_ItemCommand" OnNeedDataSource="gvCountry_NeedDataSource"

OnDetailTableDataBind="gvCountry_DetailTableDataBind" OnGridExporting="gvCountry_GridExporting" OnExcelMLExportStylesCreated="gvCountry_ExcelMLExportStylesCreated" GroupingSettings-CaseSensitive="False">

<MasterTableView CommandItemDisplay="Top" DataKeyNames="CountryId" Name="Country" EditMode="EditForms" >

<CommandItemSettings ShowExportToExcelButton="True" ShowExportToPdfButton="True"/>

<DetailTables>

<telerik:GridTableView DataKeyNames="CityId" Name="City" CommandItemDisplay="Top" Width="100%" EditMode="EditForms" PageSize="10" VirtualItemCount="1000"

AllowPaging="True" AllowCustomPaging="true">

<EditFormSettings EditFormType="Template">

<FormTemplate>

<table id="CityEditTable" style="border-collapse: collapse; border-spacing: 0.2em; position:static;

*border-collapse: expression('separate', cellSpacing = '0.1em'); width: 100%; border: 0;">

<tbody>

<tr class="EditFormHeader">

<td colspan="4" style="font-size: small">

<b>City</b>

</td>

</tr>

<tr>

<td> <asp:Label ID="dlglblDistrict" runat="server" Text="District"></asp:Label> </td>

<td> <asp:TextBox ID="dlgtxtDistrict" runat="server" Text='<%# Bind("District") %>'></asp:TextBox> </td>

<td> <asp:Label ID="dlglblCityName" runat="server" Text="CityName"></asp:Label> </td>

<td> <asp:TextBox ID="dlgtxtCityName" runat="server" Text='<%# Bind("CityName") %>'></asp:TextBox> </td>

</tr>

<tr>

<td style="text-align: center" colspan="4">

<asp:LinkButton ID="btnUpdateDetail" runat="server" CausesValidation="true" Text="Insert" />

<asp:LinkButton ID="btnCancelDetail" CommandName="Cancel" CausesValidation="false" Text="Cancel" runat="server" />

</td>

</tr>

</tbody>

</table>

</FormTemplate>

</EditFormSettings>

<Columns>

<telerik:GridButtonColumn ButtonType="ImageButton" UniqueName="reg_editDetail" ItemStyle-HorizontalAlign="Right" CommandName="Edit" ImageUrl="~/Content/Images/Edit.gif">

<HeaderStyle Width="2%" />

<ItemStyle HorizontalAlign="Right"></ItemStyle>

</telerik:GridButtonColumn>

<telerik:GridBoundColumn SortExpression="District" HeaderText="District" HeaderButtonType="TextButton" DataField="District" AutoPostBackOnFilter="true"

CurrentFilterFunction="Contains" ShowFilterIcon="false">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn SortExpression="CityName" HeaderText="CityName" HeaderButtonType="TextButton" DataField="CityName" AutoPostBackOnFilter="true"

CurrentFilterFunction="Contains" ShowFilterIcon="false">

</telerik:GridBoundColumn>

<telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" ConfirmDialogType="RadWindow"

ConfirmText="Are you sure you want to delete this registration?" ImageUrl="~/Content/Images/Delete.gif">

<HeaderStyle Width="2%" />

</telerik:GridButtonColumn>

</Columns>

</telerik:GridTableView>

</DetailTables>

<EditFormSettings EditFormType="Template" >

<FormTemplate>

<table id="MasterEditTable" style="position:static; border-collapse: collapse; border-spacing: 0.2em; *border-collapse: expression('separate', cellSpacing = '0.1em'); width: 98%;">

<tbody>

<tr class="EditFormHeader">

<td colspan="6" style="font-size: small">

<b>Country Details</b>

</td>

</tr>

<tr>

<td> <asp:Label ID="dlglblName" runat="server" Text="Name"></asp:Label> </td>

<td> <asp:TextBox ID="dlgtxtName" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox> </td>

<td> <asp:Label ID="dlglblArabicName" runat="server" Text="وطن"></asp:Label> </td>

<td> <asp:TextBox ID="dlgtxtArabicName" runat="server" Text='<%# Bind("ArabicName") %>'></asp:TextBox> </td>

<td></td><td></td>

</tr>

<tr>

<td> <asp:Label ID="dlglblNationality" runat="server" Text="Nationality"></asp:Label> </td>

<td> <asp:TextBox ID="dlgtxtNationality" runat="server" Text='<%# Bind("Nationality") %>'></asp:TextBox> </td>

<td> <asp:Label ID="dlglblArabicNationality" runat="server" Text="جنسية"></asp:Label> </td>

<td> <asp:TextBox ID="dlgtxtArabicNationality" runat="server" Text='<%# Bind("ArabicNationality") %>'></asp:TextBox> </td>

<td></td><td></td>

</tr>

<tr>

<td> <asp:Label ID="dlglblCurrencyCode" runat="server" Text="CurrencyCode" ></asp:Label> </td>

<td> <asp:TextBox ID="dltxtCurrencyCode" runat="server" Text='<%# Bind("CurrencyCode") %>'></asp:TextBox> </td>

<td> <asp:Label ID="dlglblCurrencyName" runat="server" Text="Currency" ></asp:Label> </td>

<td> <asp:TextBox ID="dlgtxtCurrencyName" runat="server" Text='<%# Bind("CurrencyName") %>'></asp:TextBox> </td>

<td> <asp:Label ID="dlglblArabicCurrencyName" runat="server" Text="عملة"></asp:Label> </td>

<td> <asp:TextBox ID="dlgtxtArabicCurrencyName" runat="server" Text='<%# Bind("ArabicCurrencyName") %>'></asp:TextBox> </td>

</tr>

<tr>

<td> <asp:Label ID="dlglblContinent" runat="server" Text="Continent" ></asp:Label> </td>

<td> <asp:TextBox ID="dlgtxtContinent" runat="server" Text='<%# Bind("Continent") %>'></asp:TextBox> </td>

<td> <asp:Label ID="dlglblRegion" runat="server" Text="Region" ></asp:Label> </td>

<td> <asp:TextBox ID="dlgtxtRegion" runat="server" Text='<%# Bind("Region") %>'></asp:TextBox> </td>

<td> <asp:Label ID="dlglblGovernmentForm" runat="server" Text="GovernmentForm"></asp:Label> </td>

<td> <asp:TextBox ID="dlgtxtGovernmentForm" runat="server" Text='<%# Bind("GovernmentForm") %>'></asp:TextBox> </td>

</tr>

<tr>

<td style="text-align: center" colspan="6">

<asp:LinkButton ID="btnUpdate" runat="server" CausesValidation="true" Text="Insert" />

<asp:LinkButton ID="btnCancel" CommandName="Cancel" CausesValidation="false" Text="Cancel" runat="server" />

</td>

</tr>

</tbody>

</table>

</FormTemplate>

</EditFormSettings>

<Columns>

<telerik:GridButtonColumn ButtonType="ImageButton" UniqueName="reg_edit" ItemStyle-HorizontalAlign="Right" CommandName="Edit" ImageUrl="~/Content/Images/Edit.gif">

<HeaderStyle Width="2%" />

<ItemStyle HorizontalAlign="Right"></ItemStyle>

</telerik:GridButtonColumn>

<telerik:GridBoundColumn UniqueName="CountryId" HeaderText="ID" DataField="CountryId" ShowFilterIcon="false">

<HeaderStyle ForeColor="Silver" Width="20px"></HeaderStyle>

<ItemStyle ForeColor="Gray"></ItemStyle>

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="Name" HeaderText="Name" DataField="Name" AutoPostBackOnFilter="true"

CurrentFilterFunction="Contains" ShowFilterIcon="false">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="ArabicName" HeaderText="وطن" DataField="ArabicName" AutoPostBackOnFilter="true"

CurrentFilterFunction="Contains" ShowFilterIcon="false">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="Nationality" HeaderText="Nationality" DataField="Nationality" AutoPostBackOnFilter="true"

CurrentFilterFunction="Contains" ShowFilterIcon="false">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="ArabicNationality" HeaderText="جنسية" DataField="ArabicNationality" AutoPostBackOnFilter="true"

CurrentFilterFunction="Contains" ShowFilterIcon="false">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="CurrencyCode" HeaderText="Code" DataField="CurrencyCode" AutoPostBackOnFilter="true"

CurrentFilterFunction="Contains" ShowFilterIcon="false">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="Currency" HeaderText="Currency" DataField="CurrencyName" AutoPostBackOnFilter="true"

CurrentFilterFunction="Contains" ShowFilterIcon="false">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="ArabicCurrencyName" HeaderText="عملة" DataField="ArabicCurrencyName" AutoPostBackOnFilter="true"

CurrentFilterFunction="Contains" ShowFilterIcon="false">

</telerik:GridBoundColumn>

<telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" ConfirmDialogType="RadWindow" ImageUrl="~/Content/Images/Delete.gif"

ConfirmText="Are you sure you want to delete this registration?">

<HeaderStyle Width="2%" />

</telerik:GridButtonColumn>

<telerik:GridBoundColumn UniqueName="Continent" HeaderText="Continent" DataField="Continent" AllowFiltering="false" Visible="false">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="Region" HeaderText="Region" DataField="Region" AllowFiltering="false" Visible="false">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="GovernmentForm" HeaderText="GovernmentForm" DataField="GovernmentForm" AllowFiltering="false" Visible="false">

</telerik:GridBoundColumn>

</Columns>

<NoRecordsTemplate> <div>There are no records to display</div> </NoRecordsTemplate>

</MasterTableView>

<ExportSettings HideStructureColumns="true" ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">

<Excel FileExtension="xlsx" Format="ExcelML" />

<Csv ColumnDelimiter="VerticalBar" />

</ExportSettings>

<ClientSettings>

<ClientEvents OnRowDblClick="RowDblClick"></ClientEvents>

</ClientSettings>

</telerik:RadGrid>

4 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 03 Dec 2013, 05:25 AM
Hello,

I am also faced same issue after upgrading the telerik DLL.

1. with template column

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource"
            AllowFilteringByColumn="true">
            <MasterTableView>
                <Columns>
                    <telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Name" UniqueName="Name" DataField="Name" SortExpression="Name">
                        <ItemTemplate>
                            <asp:Label ID="lblpass" runat="server" Text='<%# Eval("Name") %>' Width="100px"></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>




2. Without template column


<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource"
           AllowFilteringByColumn="true">
           <MasterTableView>
               <Columns>
                   <telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name">
                   </telerik:GridBoundColumn>
                   <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
               </Columns>
           </MasterTableView>
       </telerik:RadGrid>






Is this bug or functionality change in new version ?

My telerik DLL version info.




Thanks,
Jayesh Goyani
0
Khan
Top achievements
Rank 2
answered on 04 Dec 2013, 12:41 AM
Hi Jayesh,
It appears as to be bug in Telerik, well looking for solution to overcome this is degrading  to earlier version will solve this issue?
0
Jayesh Goyani
Top achievements
Rank 2
answered on 05 Dec 2013, 08:28 AM
Hello,

I will forward this issue to telerik team.

Thanks,
Jayesh Goyani
0
Khan
Top achievements
Rank 2
answered on 05 Dec 2013, 02:00 PM
That would be great and let me know if you find any alternative or permanent fix for this issue.
Tags
Grid
Asked by
Khan
Top achievements
Rank 2
Answers by
Jayesh Goyani
Top achievements
Rank 2
Khan
Top achievements
Rank 2
Share this question
or