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

RadGrid loses styles when modify command item template

4 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
catalintcg
Top achievements
Rank 1
catalintcg asked on 03 Mar 2015, 12:44 PM
Hello, Telerik team. 

I have a strange problem with radgrid. After an upgrade from VS 2012 to VS 2013 and moving from telerik.web.ui version 2013.1.417.40 to version 2013.1.417.45, the grid that in previous version worked well now seems it lost its styles.
After testing this problem I identified that the problem is related to the command item template of the grid. If the template is active the grid displays all columns and rows like plain text (see Figure 1). If I remove the command item template the grid displays its structure as a table (Figure 2), as it should be. 

This is the ASPX markup:

<telerik:RadGrid ID="grdChestionare" runat="server" AutoGenerateColumns="False" CellSpacing="0" DataSourceID="edsChestionare" GridLines="None" AllowAutomaticDeletes="True">
                <MasterTableView AllowNaturalSort="False" AllowSorting="false" CommandItemDisplay="Top" DataKeyNames="Id" DataSourceID="edsChestionare" NoDetailRecordsText="No question added." NoMasterRecordsText="No questionnaire added.">
                    <DetailTables>
                        <telerik:GridTableView runat="server" AllowNaturalSort="False" AllowSorting="True" CommandItemDisplay="Top" DataKeyNames="Id,IdIntrebare" DataSourceID="EDSIntrebari" NoDetailRecordsText="" NoMasterRecordsText="" TableLayout="Auto" >
                            <DetailTables>
                                <telerik:GridTableView runat="server" AllowNaturalSort="False" AllowSorting="True" CommandItemDisplay="Top" DataKeyNames="Id" DataSourceID="EDSVarianteRaspuns" NoMasterRecordsText="Nu există variante de răspuns" TableLayout="Fixed">
                                    <ParentTableRelation>
                                        <telerik:GridRelationFields DetailKeyField="IdIntrebare" MasterKeyField="IdIntrebare" />
                                    </ParentTableRelation>
                                    <CommandItemSettings AddNewRecordText="Adaugă o nouă variantă de răspuns." ExportToPdfText="Export to PDF" ShowAddNewRecordButton="False" />
                                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                                    </RowIndicatorColumn>
                                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                                    </ExpandCollapseColumn>
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="Enunt" FilterControlAltText="Filter colEnuntVarianta column" HeaderText="Enunt variantă răspuns" UniqueName="colEnuntVarianta">
                                            <ColumnValidationSettings>
                                                 
                                                <ModelErrorMessage Text="" />
                                                 
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="OrdineAfisare" FilterControlAltText="Filter colOrdine column" HeaderText="Ordinea de afişare" UniqueName="colOrdine">
                                            <ColumnValidationSettings>
                                                 
                                                <ModelErrorMessage Text="" />
                                                 
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                    </Columns>
                                    <EditFormSettings>
                                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                        </EditColumn>
                                    </EditFormSettings>
                                    <PagerStyle PageSizeControlType="RadComboBox" />
                                </telerik:GridTableView>
                            </DetailTables>
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="IdChestionar" MasterKeyField="Id" />
                            </ParentTableRelation>
                            <CommandItemSettings AddNewRecordText="Adaugă o nouă întrebare." ExportToPdfText="Export to PDF" ShowAddNewRecordButton="False" />
                            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridBoundColumn DataField="Intrebare.Enunt" FilterControlAltText="Filter colEnuntIntrebare column" HeaderText="Enunţul întrebării" UniqueName="colEnuntIntrebare">
                                    <ColumnValidationSettings>
                                         
                                        <ModelErrorMessage Text="" />
                                         
                                    </ColumnValidationSettings>
                                </telerik:GridBoundColumn>
                                <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="Eliminati aceasta intrebare din cadrul testului?" ConfirmTitle="Confirmati" FilterControlAltText="Filter colStergere column" HeaderText="Stergere" UniqueName="colStergere">
                                </telerik:GridButtonColumn>
                            </Columns>
                            <EditFormSettings>
                                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                </EditColumn>
                            </EditFormSettings>
                            <PagerStyle PageSizeControlType="RadComboBox" />
                            <CommandItemTemplate>
                                <telerik:RadButton ID="btnAdaugaIntrebare" runat="server" Skin="Simple" Text="Gestionează întrebările" CommandName="AdaugaIntrebare">
                                    <Icon PrimaryIconUrl="../IMG/Pictograme/add.png" />
                                </telerik:RadButton>
                            </CommandItemTemplate>
                        </telerik:GridTableView>
                    </DetailTables>
                    <CommandItemSettings AddNewRecordText="Adaugă un nou chestionar." ExportToPdfText="Export to PDF" ShowAddNewRecordButton="False" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="Denumire" FilterControlAltText="Filter Denumire column" HeaderText="Denumire" SortExpression="Denumire" UniqueName="Denumire">
                            <ColumnValidationSettings>
                                 
                                <ModelErrorMessage Text="" />
                                 
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="DataCrearii" DataType="System.DateTime" FilterControlAltText="Filter DataCrearii column" HeaderText="DataCrearii" SortExpression="DataCrearii" UniqueName="DataCrearii">
                            <ColumnValidationSettings>
                                 
                                <ModelErrorMessage Text="" />
                                 
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Autor" FilterControlAltText="Filter Autor column" HeaderText="Autor" SortExpression="Autor" UniqueName="Autor">
                            <ColumnValidationSettings>
                                 
                                <ModelErrorMessage Text="" />
                                 
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" FilterControlAltText="Filter colEditare column" UniqueName="colEditare">
                        </telerik:GridButtonColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmTextFields="Denumire" ConfirmTextFormatString="Sunteti sigur ca doriti stergerea chestionarului {0}?" ConfirmTitle="Confirmati stergerea" FilterControlAltText="Filter colDelete column" UniqueName="colDelete">
                        </telerik:GridButtonColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Sondaje" FilterControlAltText="Filter colSondaje column" HeaderText="Sondaje" ImageUrl="~/CT/IMG/Pictograme/arrow_right.png" UniqueName="colSondaje">
                        </telerik:GridButtonColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                    <PagerStyle PageSizeControlType="RadComboBox" />
                    <CommandItemTemplate>
                        <telerik:RadButton ID="btnAdaugaChestionar" runat="server" CommandName="AdaugaChestionar" Skin="Web20" Text="Adauga chestionar nou">
                            <Icon PrimaryIconUrl="../IMG/Pictograme/add.png" />
                        </telerik:RadButton>
                    </CommandItemTemplate>
                </MasterTableView>
                <PagerStyle PageSizeControlType="RadComboBox" />
                 
            </telerik:RadGrid>

I have no idea what causes this behaviour. Please help me to make this work. 

Thank you.

Catalin

4 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 06 Mar 2015, 08:21 AM
Hi Catalin,

There was a problem when templates were used in Visual Studio 2013 projects and they were being ran under .NET 4.5 but is was resolved. Please upgrade to the latest version of the controls and test the page again. If you continue to experience this problem I would like to ask you to share with us the web.config file as well so we could examine the settings.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
catalintcg
Top achievements
Rank 1
answered on 07 Mar 2015, 07:33 AM
Hello, Angel.

Thank you for your response. I will make the upgrade to the latest version of control and I'll try to see if something will change. I have noticed, also, after publishing the project on a web server that has IIS 8 installed, that the grid looks ok. On local computer however, running the app in debug mode (IIS Express 7), the problem still persists. This is the web.config for my project (for security reasons I have removed the sensitive information in the connection string). 

Thank you.
Catalin
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!--
    For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
 
    The following attributes can be set on the <httpRuntime> tag.
      <system.Web>
        <httpRuntime targetFramework="4.5" />
      </system.Web>
  -->
  
  <connectionStrings>
    <add name="cnxDB_OLKA" connectionString="Data Source=---;Initial Catalog=---;Persist Security Info=True;User ID=---;Password=---" providerName="System.Data.SqlClient" />
    <add name="cnxChestSimplu" connectionString="Data Source=---;Initial Catalog=Chestionar;Persist Security Info=True;User ID=---;Password=---" providerName="System.Data.SqlClient" />
    <add name="ctModelContainer" connectionString="metadata=res://*/CT.EF.ctModel.csdl|res://*/CT.EF.ctModel.ssdl|res://*/CT.EF.ctModel.msl;provider=System.Data.SqlClient;provider connection string="data source=---;initial catalog=Chestionar;persist security info=True;user id=---;password=---;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <system.web>
    <customErrors mode="Off" />
    <compilation strict="false" explicit="true" targetFramework="4.5" debug="true">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <add assembly="System.Web.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
      </assemblies>
      <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
      </buildProviders>
    </compilation>
    <!--<httpRuntime targetFramework="4.5" />-->
    <httpRuntime targetFramework="4.5" executionTimeout="90" maxRequestLength="65536" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true" />
    <httpHandlers>
      <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" />
      <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <remove name="Telerik_Web_UI_WebResource_axd" />
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
    </handlers>
  </system.webServer>
</configuration>
0
Angel Petrov
Telerik team
answered on 11 Mar 2015, 01:46 PM
Hi,

After upgrading to the latest version you should not experience any issues. Additionally try changing the below setting in the web.config file when running the application with the one you are currently using and check whether this resolves the matter.
<compilation strict="false" explicit="true" targetFramework="4.5" debug="false">


Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
catalintcg
Top achievements
Rank 1
answered on 12 Mar 2015, 07:29 AM
Thank you for the answer. I will make the changes you suggested.

Catalin
Tags
Grid
Asked by
catalintcg
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
catalintcg
Top achievements
Rank 1
Share this question
or