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

Possible bug related to skins interacting with GridDropDownColumn

8 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carl
Top achievements
Rank 1
Carl asked on 01 Dec 2008, 03:17 AM
I have a RadGrid that was working just fine with the built-in "Telerik" skin. I made a copy of the "Telerik" skin as preparation for modifying it for my own custom skin. So I followed all the directions to get a copy of the skin working in a new custom skin directory. So far the only changes in the css file for the new custom skin are the name changes throughout with "_NewTelerik" replacing every "_Telerik". And the new custom skin works for the most part except for one thing I noticed: one of my GridDropDownColumns stopped working. It was completely non-functional. In addition, next to it was rendered the text "select".

Again, note that other than necessary changes such as EnableEmbeddedSkins from true to false, I made NO changes anywhere else in my *.aspx or any changes in my code-behind. Also, note that all my GridDropDownColumns worked just fine with the original "Telerik" skin and EnableEmbeddedSkins="true", but one stopped working when I switched to the new custom skin "NewTelerik" and EnableEmbeddedSkins="false". And again, I have not yet made any substantive changes to the css file, so there's something funny here. A bug?

I tracked the difference between the GridDropDownColumns that work with both original and new skins and those that work only with the original skin to DropDownControlType. So GridDropDownColumns with DropDownControlType="RadComboBox" only work with the built-in skin "Telerik" and not with the custom skin "NewTelerik" even though there have not been any style changes in the css style file.

8 Answers, 1 is accepted

Sort by
0
Carl
Top achievements
Rank 1
answered on 01 Dec 2008, 07:02 AM

I've been able to get all the GridDropDownColumns to work with the new custom skin by setting the DropDownControlType for all of them to DropDownList.

 

On a related matter to these dropdownlists, I have NOT been able to get a default value set for a new insert item. I have used the technique explained near the bottom of

 

http://www.telerik.com/help/aspnet/grid/grdinsertingvaluesinplaceandeditforms.html

but without success. Using that technique (predefined values via System.Collections.Specialized.ListDictionary passed to InsertItem), I am able to set defaults for textboxes, for checkboxes, but not for the DropDownLists.

0
Sebastian
Telerik team
answered on 01 Dec 2008, 08:08 AM
Hello Carl,

Basically, the approach with the predefined values for dropdown list on init insert should be applicable as well. Have you tested the codeless solution with empty dropdown item and AppendDataBoundItems = true? It should be more straight-forward and will save you extra coding inside the ItemCommand handler.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Carl
Top achievements
Rank 1
answered on 01 Dec 2008, 06:19 PM
Well, there's a problem with some of the Telerik demos and examples for these DropDownLists in the sense that they are somewhat "contrived" with the same datafield being used for both DataTextField and DataValueField. Take the example you to which you referred:

<rad:GridTemplateColumn> 
  <ItemTemplate> 
     <%# Eval("ProductID") %> 
   </ItemTemplate> 
     <EditItemTemplate> 
     <asp:DropDownList ID="DropDownList1" AppendDataBoundItems="true" DataSourceID="AccessDataSource2" 
       DataTextField="ProductID" DataValueField="ProductID" SelectedValue='<%# Bind("ProductID") %>' runat="server"
         <asp:ListItem Text="" Value="" /> 
       </asp:DropDownList> 
     </EditItemTemplate> 
</rad:GridTemplateColumn> 

Again, look at "ProductID" being used for both DataTextField and DataValueField. A better scenario and more realistic scenario is when the DataValueField is an integer code and the DataTextField is a string name. I believe this is why there are issues throughout the Telerik controls related to DropDownLists, GridTemplateColumns, and Filtering by text versus Filtering by value.

If all of the use cases, test cases, etc, were done with meaningful distinctions between DataTextField and DataValueField, then there would be better Telerik development of these controls, and easier use for Telerik customers who use these controls.

So how do you do a GridTemplateColumn for a DropDownList where you want the DataTextField to show up in the ItemTemplate and the DataValueField to be bound in the EditItemTemplate???


0
Sebastian
Telerik team
answered on 02 Dec 2008, 09:41 AM
Hello Carl,

In the situation you depicted you merely need to change the DataTextField for the comboboxes from the edit template to retrieve the data from the ProductName column in the source (for example) and do the same for the DataBoundLiteralControl created in the item template of the column, i.e.:

<rad:GridTemplateColumn>    
  <ItemTemplate>    
     <%# Eval("ProductName") %>    
   </ItemTemplate>    
     <EditItemTemplate>    
     <asp:DropDownList ID="DropDownList1" AppendDataBoundItems="true" DataSourceID="AccessDataSource2"    
       DataTextField="ProductName" DataValueField="ProductID" SelectedValue='<%# Bind("ProductID") %>' runat="server">    
         <asp:ListItem Text="" Value="" />    
       </asp:DropDownList>    
     </EditItemTemplate>    
</rad:GridTemplateColumn>    
 

The rest of the logic can remain unchanged.

Kind regards,

Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Carl
Top achievements
Rank 1
answered on 03 Dec 2008, 01:08 AM
Well again the suggested solution is not sufficiently realistic and does not work. Using the approach, you suggested here's the code:

                <telerik:GridTemplateColumn DataField="ResourceRegistrarGuid" DataType="System.Guid" 
                    HeaderText="Registrar" SortExpression="ResourceRegistrarGuid" UniqueName="ResourceRegistrarGuid" 
                    AllowFiltering="False" ReadOnly="true"
                    <ItemTemplate> 
                        <asp:Label ID="lblResourceRegistrarName" runat="server" Text='<%# Eval("ResourceName") %>' /> 
                    </ItemTemplate> 
                    <EditItemTemplate> 
                        <asp:DropDownList ID="ddlResourceRegistrarGuid" runat="server" DataSourceID="sdsRegistrarsListForAgent" 
                            DataTextField="ResourceName" DataValueField="ResourceGuid" SelectedValue='<%# Bind("ResourceRegistrarGuid")  %>' /> 
                    </EditItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn DataField="ResourceRegistryGuid" DataType="System.Guid" 
                    HeaderText="Registry" SortExpression="ResourceRegistryGuid" UniqueName="ResourceRegistryGuid" 
                    AllowFiltering="False"
                    <ItemTemplate> 
                        <asp:Label ID="lblResourceRegistryName" runat="server" Text='<%# Eval("ResourceName") %>' /> 
                    </ItemTemplate> 
                    <EditItemTemplate> 
                        <asp:DropDownList ID="ddlResourceRegistryGuid" runat="server" DataSourceID="sdsRegistriesListForAgent" 
                            DataTextField="ResourceName" DataValueField="ResourceGuid" SelectedValue='<%# Bind("ResourceRegistryGuid")  %>' /> 
                    </EditItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn DataField="ResourceDirectoryGuid" DataType="System.Guid" 
                    HeaderText="Directory" SortExpression="ResourceDirectoryGuid" UniqueName="ResourceDirectoryGuid" 
                    AllowFiltering="False" ReadOnly="true"
                    <ItemTemplate> 
                        <asp:Label ID="lblResourceDirectoryName" runat="server" Text='<%# Eval("ResourceName") %>' /> 
                    </ItemTemplate> 
                    <EditItemTemplate> 
                        <asp:DropDownList ID="ddlResourceDirectoryGuid" runat="server" DataSourceID="sdsDirectoriesListForAgent" 
                            DataTextField="ResourceName" DataValueField="ResourceGuid" SelectedValue='<%# Bind("ResourceDirectoryGuid")  %>' /> 
                    </EditItemTemplate> 
                </telerik:GridTemplateColumn> 
 

But it does not work correctly because the three different GridTemplateColumns do not display distinct results corresponding to the distinct DataSourceId's that are different in each of the the three GridTemplateColumns. So far, the only solution that I've been able to get to work is to modify the select statement in the DataSource for the MasterTable so that each row record returns for each column both the correct Name and Guid values for each of the columns. Then the markup for the GridTemplateColumns looks like this:

                <telerik:GridTemplateColumn DataField="ResourceRegistrarGuid" DataType="System.Guid" 
                    HeaderText="Registrar" SortExpression="ResourceRegistrarGuid" UniqueName="ResourceRegistrarGuid" 
                    AllowFiltering="False" ReadOnly="true"
                    <ItemTemplate> 
                        <asp:Label ID="lblResourceRegistrarName" runat="server" Text='<%# Eval("ResourceRegistrarName") %>' /> 
                    </ItemTemplate> 
                    <EditItemTemplate> 
                        <asp:DropDownList ID="ddlResourceRegistrarGuid" runat="server" DataSourceID="sdsRegistrarsListForAgent" 
                            DataTextField="ResourceName" DataValueField="ResourceGuid" SelectedValue='<%# Bind("ResourceRegistrarGuid")  %>' /> 
                    </EditItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn DataField="ResourceRegistryGuid" DataType="System.Guid" 
                    HeaderText="Registry" SortExpression="ResourceRegistryGuid" UniqueName="ResourceRegistryGuid" 
                    AllowFiltering="False"
                    <ItemTemplate> 
                        <asp:Label ID="lblResourceRegistryName" runat="server" Text='<%# Eval("ResourceRegistryName") %>' /> 
                    </ItemTemplate> 
                    <EditItemTemplate> 
                        <asp:DropDownList ID="ddlResourceRegistryGuid" runat="server" DataSourceID="sdsRegistriesListForAgent" 
                            DataTextField="ResourceName" DataValueField="ResourceGuid" SelectedValue='<%# Bind("ResourceRegistryGuid")  %>' /> 
                    </EditItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn DataField="ResourceDirectoryGuid" DataType="System.Guid" 
                    HeaderText="Directory" SortExpression="ResourceDirectoryGuid" UniqueName="ResourceDirectoryGuid" 
                    AllowFiltering="False" ReadOnly="true"
                    <ItemTemplate> 
                        <asp:Label ID="lblResourceDirectoryName" runat="server" Text='<%# Eval("ResourceDirectoryName") %>' /> 
                    </ItemTemplate> 
                    <EditItemTemplate> 
                        <asp:DropDownList ID="ddlResourceDirectoryGuid" runat="server" DataSourceID="sdsDirectoriesListForAgent" 
                            DataTextField="ResourceName" DataValueField="ResourceGuid" SelectedValue='<%# Bind("ResourceDirectoryGuid")  %>' /> 
                    </EditItemTemplate> 
                </telerik:GridTemplateColumn> 
 

And this approach does work successfully including also being able to set appropriate initial default values in the code-behind file. The only disadvantage is that a lot of extra output has to be generated from the Select statement for the DataSource on the MasterTable. Although I have not yet integrated filtering (note that Filtering is turned off).

 Again, I recommend that the Telerik team use more realistic case scenarios when developing/testing controls involving dropdownlists, filters for dropdownlists, and defaults for dropdownlists. This is the one area of the RadControls for ASP.NET that in my opinion needs the most attention for fixing what I'll call "inconveniences" or "issues" that need "work-arounds" or extra coding when it seems the capabilities should be built-in.





0
Sebastian
Telerik team
answered on 05 Dec 2008, 12:40 PM
Hi Carl,

Thank you for your feedback - we will definitely consider improving the information in the RadGrid online resources concerning the configuration of dropdown lists inside edit templates of template columns.The presently available articles on this subject are listed below:

http://www.telerik.com/help/aspnet-ajax/grdoperationswithdropdownlistinedititemtemplate.html (template column with dropdown list editor)
http://www.telerik.com/support/kb/article/b454K-gmk-b454T-cbb.aspx (dropdown/combobox editors in template RadGrid columns)
http://www.telerik.com/help/aspnet-ajax/grdcustomizeconfiguregriddropdowncolumn.html (built-in GridDropDownColumn)

On the other hand, we will appreciate if you perform a quick test and see whether the same configuration for the dropdown list editors works in a regular MS GridView (placing the combo editors inside edite templates of template fields). Basically, the template columns of RadGrid should exhibit the same behavior as the regular GridView template columns.

Therefore, if you can attain the requested behavior without SELECT query modification for the MS control, please submit this demo project via our support ticket system and we will gladly include RadGrid implementation beside it which mimics the same behavior.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Carl
Top achievements
Rank 1
answered on 08 Dec 2008, 06:10 PM
Well, I'm happy to test and/or beta-test anything, but I do not understand the point of the test you suggest.

If something fails in the standard Microsoft control, then what does that prove?

I thought that the whole point of paying extra money to a third-party company, Telerik, to buy third-party controls, RadGrid, was to get something that Microsoft fails to provide. So if some feature fails in Microsoft, then that is all the more reason for Telerik to provide the feature because Microsoft does not!!!!

Also, just to be careful to avoid any confusion, we should be careful to distinguish the select query for the MasterTable data source from the various select queries in the other data sources used to generate the dropdowncontrols for some of the columns of the MasterTable......
0
Sebastian
Telerik team
answered on 09 Dec 2008, 09:28 AM
Hello Carl,

I proposed you to test the same scenario with the regular GridView control because RadGrid extends the built-in capabilities of the plain GridView by bringing various features/enhancements and at the same time making the migration process seamless. Here is the white paper providing comparison between RadControls for ASP.NET AJAX and the default Microsoft web controls in Visual Studio:

http://www.telerik.com/Libraries/Documents/controls.sflb

Hence if some type of functionality works as expected with MS GridView, it is very likely that it will function properly with RadGrid for ASP.NET AJAX when the object model of both products is pretty similar. I apologize if you found my last explanation/suggestion confusing or misleading in some way.

Kind regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Carl
Top achievements
Rank 1
Answers by
Carl
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or