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

Problem in HeaderContextMenu

3 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sudha
Top achievements
Rank 1
Sudha asked on 14 Nov 2011, 07:18 AM
Hi,
We have a rad grid for which , EnableHeaderContextMenu= true is set.
We are able to get the menu , but a few item gets repeated ( without checkbox). Please find the screen shot and the code attached.
Kindly help us resolving this issue as early as possible , as we have the deployment very soon.


Thanks,
Sudha.
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
  
<script type="text/javascript">
  
function OnClientItemOpening(menu, args) {
  
var item = args.get_item();
  
item.get_items().getItem(0).get_element().style.display = "none";
  
item.get_items().getItem(1).get_element().style.display = "none";
  
item.get_items().getItem(7).get_element().style.display = "none";
  
item.get_items().getItem(8).get_element().style.display = "none";
  
item.get_items().getItem(12).get_element().style.display = "none";
  
item.get_items().getItem(13).get_element().style.display = "none";
  
  
</script>
  
</telerik:RadCodeBlock>
  
  
<telerik:RadGrid ID="dgFileList" OnItemDataBound="dgFileList_ItemDataBound" OnSortCommand="dgFileList_SortCommand"
                                            runat="server" Skin="SLB" CellSpacing="1" CellPadding="0" BorderStyle="Solid"
                                            BorderWidth="0px" Width="100%" Height="359px" AutoGenerateColumns="False" GridLines="None"
                                            AllowSorting="True" HeaderStyle-Height="30px" EnableEmbeddedSkins="False" ImagesPath="~/Skins/SLB/Grid"
                                            EnableHeaderContextMenu="true"
                                            <HeaderContextMenu OnClientItemOpening="OnClientItemOpening"
                                            </HeaderContextMenu
                                            <ClientSettings
                                                <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
                                                <Selecting AllowRowSelect="true" /> 
                                                <ClientEvents OnGridCreated="GridCreated_FileList" /> 
                                                <Resizing AllowResizeToFit="true" AllowColumnResize="True" AllowRowResize="false"
                                                    ResizeGridOnColumnResize="true" ClipCellContentOnResize="false" EnableRealTimeResize="true" /> 
                                            </ClientSettings
                                            <HeaderStyle Font-Underline="False" Height="30px" Width="100%" /> 
                                            <ItemStyle Height="100%" /> 
                                            <AlternatingItemStyle Height="100%" /> 
                                            <MasterTableView AllowNaturalSort="true" AllowCustomSorting="true" ShowHeadersWhenNoRecords="true"
                                                NoMasterRecordsText="No files found for the selected product."
                                                <Columns
                                                    <telerik:GridBoundColumn UniqueName="FileID" DataField="FileID" HeaderText="FileID"
                                                        Display="false"
                                                        <HeaderStyle Wrap="False" HorizontalAlign="Center" /> 
                                                        <ItemStyle Wrap="true" HorizontalAlign="Left" CssClass="RadGridRow" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="ProductDetails" DataField="ProductDetails" HeaderText="Description"
                                                        SortExpression="ProductDetails" Visible="true" Display="true"
                                                        <HeaderStyle Width="200" Wrap="false" HorizontalAlign="Center" /> 
                                                        <ItemStyle Wrap="true" HorizontalAlign="Left" CssClass="RadGridRow" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="Version" DataField="Version" HeaderText="Version"
                                                        SortExpression="Version" Visible="true"
                                                        <HeaderStyle Width="70" Wrap="False" HorizontalAlign="Center" /> 
                                                        <ItemStyle Wrap="true" HorizontalAlign="Left" CssClass="RadGridRow" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="Release" DataField="Release" HeaderText="Released"
                                                        SortExpression="ReleaseDate" HeaderStyle-Width="65"
                                                        <HeaderStyle Width="75" Wrap="False" HorizontalAlign="Center" /> 
                                                        <ItemStyle Wrap="true" HorizontalAlign="Left" CssClass="RadGridRow" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="ContentType" DataField="ContentType" HeaderText="ContentType"
                                                        SortExpression="ContentType" Visible="true"
                                                        <HeaderStyle Width="93" Wrap="False" HorizontalAlign="Center" /> 
                                                        <ItemStyle Wrap="true" HorizontalAlign="Left" CssClass="RadGridRow" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="Published" DataField="Published" HeaderText="Published"
                                                        SortExpression="PublishedDate" Visible="False"
                                                        <HeaderStyle Width="80" Wrap="False" HorizontalAlign="Center" /> 
                                                        <ItemStyle Wrap="true" HorizontalAlign="Left" CssClass="RadGridRow" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="Platform" DataField="Platform" HeaderText="Platform"
                                                        SortExpression="Platform" Visible="true"
                                                        <HeaderStyle Width="105" Wrap="true" HorizontalAlign="Center" /> 
                                                        <ItemStyle Wrap="true" HorizontalAlign="Left" CssClass="RadGridRow" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="Description" DataField="Description" HeaderText="Description"
                                                        SortExpression="Description" Visible="false"
                                                        <HeaderStyle Wrap="False" HorizontalAlign="Center" /> 
                                                        <ItemStyle Wrap="true" HorizontalAlign="Left" CssClass="RadGridRow" /> 
                                                    </telerik:GridBoundColumn
<telerik:GridButtonColumn UniqueName="btnDetails" ButtonType="ImageButton" Text="Details"
                                                        HeaderText="Details" ImageUrl="Images/Info.png"
                                                        <HeaderStyle Width="50" Wrap="False" HorizontalAlign="Left" /> 
                                                        <ItemStyle HorizontalAlign="Center" CssClass="RadGridRow" Font-Bold="true" /> 
                                                    </telerik:GridButtonColumn
                                                    <telerik:GridButtonColumn UniqueName="btnDownload" ButtonType="ImageButton" HeaderText="Download"
                                                        Text="Available for download" ImageUrl="Images/Download.png"
                                                        <HeaderStyle Width="65" Wrap="False" HorizontalAlign="Left" /> 
                                                        <ItemStyle HorizontalAlign="Center" CssClass="RadGridRow" /> 
                                                    </telerik:GridButtonColumn
                                                    <telerik:GridBoundColumn UniqueName="FileSize" DataField="formatedsize" HeaderText="Size[KB]"
                                                        SortExpression="size" Visible="true"
                                                        <HeaderStyle Width="70" Wrap="False" HorizontalAlign="Left" /> 
                                                        <ItemStyle Wrap="true" HorizontalAlign="Left" CssClass="RadGridRow" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="ThirdPartyEnabled" DataField="ThirdPartyEnabled"
                                                        HeaderText="ThirdPartyEnabled" Visible="false"
                                                        <HeaderStyle Wrap="False" HorizontalAlign="Center" /> 
                                                        <ItemStyle Wrap="true" HorizontalAlign="Left" CssClass="RadGridRow" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="FileName" DataField="FileName" HeaderText="FileName"
                                                        SortExpression="FileName"
                                                        <HeaderStyle Width="135" Wrap="False" HorizontalAlign="Center" /> 
                                                        <ItemStyle Wrap="false" HorizontalAlign="Left" CssClass="RadGridRow" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="RelatedLinks" DataField="RelatedLinks" HeaderText="RelatedLinks"
                                                        SortExpression="RelatedLinks"
                                                        <HeaderStyle Wrap="false" HorizontalAlign="Center" /> 
                                                        <ItemStyle Wrap="true" HorizontalAlign="Left" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="fileSizeValue" DataField="size" HeaderText="filesize"
                                                        Display="false"
                                                        <HeaderStyle Width="0px" /> 
                                                        <ItemStyle Width="0px" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="MD5CheckSum" DataField="MD5CheckSum" HeaderText="MD5CheckSum"
                                                        Display="false"
                                                        <HeaderStyle Width="0px" /> 
                                                        <ItemStyle Width="0px" /> 
                                                    </telerik:GridBoundColumn
                                                    <telerik:GridBoundColumn UniqueName="CollectionName" DataField="CollectionName" HeaderText="CollectionName"
                                                        SortExpression="CollectionName" Visible="false"
                                                        <HeaderStyle Width="0" Wrap="false" HorizontalAlign="Center" /> 
                                                        <ItemStyle Wrap="true" HorizontalAlign="Left" /> 
                                                    </telerik:GridBoundColumn
                                                </Columns
                                                <EditFormSettings
                                                    <EditColumn CancelImageUrl="~/Skins/SLB/Grid\Cancel.gif" EditImageUrl="~/Skins/SLB/Grid\Edit.gif"
                                                        FilterControlAltText="Filter EditCommandColumn column" FilterImageUrl="~/Skins/SLB/Grid\Filter.gif"
                                                        InsertImageUrl="~/Skins/SLB/Grid\Update.gif" SortAscImageUrl="~/Skins/SLB/Grid\SortAsc.gif"
                                                        SortDescImageUrl="~/Skins/SLB/Grid\SortDesc.gif" UpdateImageUrl="~/Skins/SLB/Grid\Update.gif"
                                                    </EditColumn
                                                </EditFormSettings
                                            </MasterTableView
                                        </telerik:RadGrid>

3 Answers, 1 is accepted

Sort by
0
Sudha
Top achievements
Rank 1
answered on 14 Nov 2011, 07:24 AM
Hi,
In addition to the below problem, there is one more issue. After hiding the column , the gird size reduces instead we want the original size of the grid to be retained. Code is attached. Please let us know if we are missing something.

Thanks,
Sudha.
0
Sudha
Top achievements
Rank 1
answered on 16 Nov 2011, 10:19 AM
Hi,
Any updates on this ??

Thanks,
Sudha
0
Maria Ilieva
Telerik team
answered on 16 Nov 2011, 03:06 PM
Hello Sudha,

It seems that the attachment of the mentioned screenshot failed for some reason. I revise the provided code and was not able to isolate any obvious reason for the duplicated items. Could I kindly ask you to open a regular support ticket and send us runnable version of your application which demonstrates the mentioned issue. Thus we will be able to debug it locally and do our best to provide proper solution.

Kind regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Sudha
Top achievements
Rank 1
Answers by
Sudha
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or