Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
177 views

Hi I have a RadGrid that is inside of a UserControl, and is used inside of an aspx page that contains a RadPanelBar.  When the user clicks the RadPanlBar buttons the gird is displayed.  I have to use a filter on my grid, but I only want the filter to display if a certain RadPanelBar button is clicked.  I have the following code in my RadPanlBar ItemClick event.

protected void CategoriesPanelBar_ItemClick(object sender, RadPanelBarEventArgs e)
    {
        e.Item.Selected = true;
        if (e.Item.Expanded || e.Item.Items.Count == 0)
        {
            // This is a leaf we select the parent and this child only
            if (e.Item.Items.Count == 0)
            {
                createDiscountGridControl.SelectedParentCategory = ((RadPanelItem)e.Item.Parent).Value;
                createDiscountGridControl.SelectedCategory = e.Item.Value;
            }
            else
            {
                createDiscountGridControl.SelectedParentCategory = e.Item.Value;
                createDiscountGridControl.SelectedCategory = null;
            }
            createDiscountGridControl.Rebind();
            //createFilter(int.Parse(e.Item.Value)); 
            if (e.Item.Value == "319")
            {
                Controls.DiscountGrid userControl = createDiscountGridControl;

                var rg = ((RadGrid)userControl.FindControl("RadGridDiscounts"));

                GridColumn column = rg.MasterTableView.GetColumnSafe("ProductName");
                column.CurrentFilterFunction = GridKnownFunction.Contains;
                column.CurrentFilterValue = "Product_Name";
                rg.AllowFilteringByColumn = true;

                rg.MasterTableView.Rebind(); 

            }
        }
    }

 

This line is the button that when clicked should show the grid.  

 

if (e.Item.Value == "319")

 

I'm getting a null reference exception on the line 

GridColumn column = rg.MasterTableView.GetColumnSafe("ProductName");

 

column is coming back null.  It's like it can't find the column inside of the Grid.  Here is the code for my RadGrid UserControl.  The column in question has a unique name of ProductName.

 

​​​​<telerik:RadGrid ID="RadGridDiscounts" runat="server" ShowStatusBar="true" 
         AllowFilteringByColumn="true" AllowMultiRowSelection="false" AutoGenerateColumns="false" 
        OnNeedDataSource="RadGridDiscounts_NeedDataSource" OnPreRender="RadGridDiscounts_PreRender"
        OnItemDataBound="RadGridDiscounts_ItemDataBound" Skin="Web20" ClientSettings-AllowExpandCollapse="true" OnInit="RadGridDiscounts_Init" OnDetailTableDataBind="RadGridDiscounts_DetailTableDataBind" OnItemCreated="RadGridDiscounts_ItemCreated">
        <PagerStyle Mode="NumericPages" />

        <MasterTableView DataKeyNames="Category_ID" AllowMultiColumnSorting="true" HierarchyLoadMode="Client" DataMember="Categories">

            <DetailTables>

                <telerik:GridTableView DataKeyNames="Product_ID" Name="Products" HierarchyLoadMode="Client" DataMember="Products">
                    <ColumnGroups>
                        <telerik:GridColumnGroup HeaderText="Parent" Name="Parent" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
                        <telerik:GridColumnGroup HeaderText="Account" Name="Discount" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
                        <telerik:GridColumnGroup HeaderText="Margin" Name="Margin" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
                    </ColumnGroups>

                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="Category_ID" MasterKeyField="Category_ID" />
                    </ParentTableRelation>

                    <%--Detail Table For Second Spiff--%>
                    <DetailTables>
                        <telerik:GridTableView HierarchyLoadMode="Client" Name="SecondSpiffs" DataMember="SecondSpiffs" runat="server" >
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="SpiffProductID" MasterKeyField="Product_ID"></telerik:GridRelationFields>
                            </ParentTableRelation>
                            <Columns>
                                <telerik:GridBoundColumn UniqueName="SpiffSplitProductID" HeaderText="Spiff Product ID" DataField="SpiffSplitProductID"></telerik:GridBoundColumn>
                                
                                <telerik:GridBoundColumn HeaderText="Spiff Product Name" DataField="SpiffProductName" UniqueName="Attribute" AllowFiltering="true">                                   
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn HeaderText="Lock Discount" UniqueName="LockDiscount" AllowFiltering="false">
                                    <ItemTemplate>
                                        <asp:CheckBox ID="chkLockDiscount" runat="server" Checked='<%# Eval("Lock_Discount") %>'/>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="Approved To Sell" AllowFiltering="false">
                                    <ItemTemplate>
                                        <asp:CheckBox ID="chkStatus" runat="server" Checked='<%# Eval("ApprovedToSell_Flg") %>'/>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="Parent Spiff" AllowFiltering="false">
                                    <ItemTemplate>
                                        <asp:Label ID="ParentSpiff" runat="server" Text='<%# Eval("ParentSpiffAmount") %>'></asp:Label>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="Discount" AllowFiltering="false">
                                    <ItemTemplate>
                                        <asp:TextBox ID="ChildSpiff" runat="server" Columns="7" Text='<%# Eval("ChildSpiffAmount") %>' ></asp:TextBox>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn Display="false">
                                    <ItemTemplate>
                                        <asp:Label id="SpiffOrder" runat="server" Text='<%# Eval("Order") %>'></asp:Label>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn UniqueName="SpiffSplitMappingID" Display="false" DataField="SpiffSplitMappingID" />
                                <telerik:GridBoundColumn UniqueName="SpiffProductID" Display="false" DataField="SpiffProductID" />
                                <telerik:GridBoundColumn UniqueName="SpiffSplitID" Display="false" DataField="SpiffSplitID" />
                                <telerik:GridCheckBoxColumn DataField="Lock_Discount" UniqueName="hfDiscountLock" Display="false" />
                            </Columns>
                        </telerik:GridTableView>
                    </DetailTables>

                    <Columns>

                        <telerik:GridBoundColumn SortExpression="Product_ID" HeaderText="Product ID" DataField="Product_ID" AllowFiltering="false" />
                        
                        <%--<telerik:GridBoundColumn SortExpression="Product_Name" HeaderText="Product Name" DataField="Product_Name" UniqueName="ProductName" AllowFiltering="true" CurrentFilterFunction="Contains" ShowFilterIcon="true" AutoPostBackOnFilter="true">
                                                                       
                        </telerik:GridBoundColumn>--%>      
                        <telerik:GridBoundColumn SortExpression="Product_Name" HeaderText="Product Name" DataField="Product_Name" UniqueName="ProductName">
                                                                       
                        </telerik:GridBoundColumn>                  

                        <telerik:GridTemplateColumn HeaderText="Approved To Sell" AllowFiltering="false">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkApprovedToSell" runat="server" Checked='<%# CheckApprovedToSellFlag(Container.DataItem) %>' />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn HeaderText="Lock Discount" UniqueName="LockDiscount" AllowFiltering="false">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkLockDiscount" runat="server" Checked='<%# Eval("Lock_Discount") %>' />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn HeaderText="Discount" ColumnGroupName="Parent" ItemStyle-Width="120px" AllowFiltering="false">
                            <ItemTemplate>
                                <asp:Label ID="txtParentDiscount" runat="server" Text='<%# DiscountFormat(Container.DataItem, "parent") %>'>
                                </asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn HeaderText="Price" ColumnGroupName="Parent" ItemStyle-Width="120px" AllowFiltering="false">
                            <ItemTemplate>
                                <asp:Label ID="txtParentPrice" runat="server" Text='<%# FinalPriceFormat(Container.DataItem, "parent") %>'>
                                </asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn HeaderText="Discount" ColumnGroupName="Discount" ItemStyle-Width="120px" AllowFiltering="false">
                            <ItemTemplate>
                                <asp:TextBox ID="txtAccountDiscount" runat="server" Text='<%# DiscountFormat(Container.DataItem, "account") %>' Width="80%"></asp:TextBox>
                                <asp:Label ID="lblNewProduct" runat="server" Font-Bold="true" ForeColor="Red"  Font-Size="Large"></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn HeaderText="Price" ColumnGroupName="Discount" ItemStyle-Width="120px" AllowFiltering="false">
                            <ItemTemplate>
                                <asp:TextBox ID="txtAccountPrice" runat="server" Text='<%# FinalPriceFormat(Container.DataItem, "account") %>' Width="80%" Enabled="<%# PriceEnable(Container.DataItem) %>"></asp:TextBox>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn HeaderText="Discount" UniqueName="Margin" ColumnGroupName="Margin" ItemStyle-Width="120px" AllowFiltering="false">
                            <ItemTemplate>
                                <asp:Label ID="txtMargin" runat="server" Text='<%# DiscountFormat(Container.DataItem, "margin") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn HeaderText="Amount" ColumnGroupName="Margin" ItemStyle-Width="120px" AllowFiltering="false">
                            <ItemTemplate>
                                <asp:Label ID="txtMarginPrice" runat="server" Text='<%# FinalPriceFormat(Container.DataItem, "margin") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn HeaderText="Discount Type" AllowFiltering="false">
                            <ItemTemplate>                                                
                                <asp:RadioButton ID="rbDollar"  runat="server" Text="$" GroupName="DiscountType" AutoPostBack="false" Checked='<%#CheckDollarDiscountType(Container.DataItem)%>' Enabled="false"/>                                      
                                <asp:RadioButton ID="rbPercent" runat="server" Text="%" GroupName="DiscountType" AutoPostBack="false" Checked='<%#CheckPercentDiscountType(Container.DataItem)%>' Enabled="false"/>                                             
                                <asp:HiddenField ID="hfProductID" runat="server" Value='<%# Eval("Product_ID") %>' />
                                <asp:HiddenField ID="hfDiscountLock" runat="server" Value='<%# Eval("Lock_Discount") %>' />
                                <asp:HiddenField ID="hfBasePrice" runat="server" Value='<%# Eval("Base_Price") %>' />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

                    </Columns>

                </telerik:GridTableView>
            </DetailTables>
            <Columns>
                <telerik:GridBoundColumn SortExpression="Parent_ID" HeaderText="Parent_ID" DataField="Parent_ID" Visible="false"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="Category_Name" HeaderText="Category" HeaderButtonType="TextButton" DataField="Category_Name" Visible="false"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="Carrier_Name" HeaderText="Product Category" HeaderButtonType="TextButton" DataField="Carrier_Name" AllowFiltering="false"></telerik:GridBoundColumn>
                <telerik:GridTemplateColumn HeaderText="Parent Discount" Visible="true" AllowFiltering="false">
                    <ItemTemplate>
                        <asp:label ID="lblCarrierParentAccountDiscount" runat="server" Text="" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Apply Approved To Sell To All" Visible="true" AllowFiltering="false">
                    <ItemTemplate>
                        <asp:CheckBox ID="chkCarrierApprovedToSell" runat="server" Text="" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Discount" Visible="true" AllowFiltering="false">
                    <ItemTemplate>
                        <asp:TextBox ID="txtCarrierAccountDiscount" runat="server"></asp:TextBox>
                        <asp:Label ID="txtCarrierNewProduct" runat="server" BorderStyle="None" Font-Bold="true" ForeColor="Red"  Font-Size="Large"></asp:Label>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView> 
        <ClientSettings>
            
        </ClientSettings>    

    </telerik:RadGrid>

Viktor Tachev
Telerik team
 answered on 09 Sep 2015
1 answer
122 views

Hi Team,

Good evening.


We are using RAD Editor of  Telerik   .We are facing some issue on “RealFontSizes” tag  while retrieving  font size dropdown  .
Below is the code which we are using to get the size in “pt”

<RealFontSizes>
    <telerik:EditorRealFontSize Value="12pt" />
    <telerik:EditorRealFontSize Value="26pt" />
    <telerik:EditorRealFontSize Value="36pt" />
</RealFontSizes>


But we are facing below issue while running in IE browser :

    When we are selecting any size from dropdown ,its coming as in “ pt”  as shown in the attached "radeditior_fnt_pt_ select.png" file.
     But when we select any size eg. (26pt as above)  it is displaying it as in  “pixel “ after the selection as shown in the attached "radeditior_fnt_px_dsply" file.

It will be if you can provide any solution on this ,so that if I will  select “26pt” it should show me “26 pt”.


Thanks and Regards,
Swetalana

Ianko
Telerik team
 answered on 09 Sep 2015
3 answers
1.4K+ views

    I am using CSS print media query to modify page layout when printing and I am unable to set the following. All other styles are working properly.

@media print{
    thead{display:table-header-group;}
    tr{page-break-inside:avoid;}
}

The following post is quite old, but should still work, however it doesn't. All I see where I expect to see the header on each page is a small black border box just under the first column header on each page as seen in the attached files.

http://www.telerik.com/support/code-library/printing-grid-headers-on-every-page

Page breaks also aren't working to prevent rows from being cutoff. The grid spans multiple pages and rows should not be cutoff between pages.

Any suggestions are greatly appreciated.

 

 
Kostadin
Telerik team
 answered on 09 Sep 2015
3 answers
394 views
Hi Telerik,

File filtering is not working in google chrome, but in IE it is ok.

Telerik Version: 2012.3.1127.35
Runtime Version: v2.0.50727

<telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1"  OnClientFileUploaded="OnFileUploaded"         OnClientFileUploadRemoved="OnClientValidationFailed"
                        OnClientFileDropped="OnClientValidationFailed" OnClientValidationFailed="OnClientValidationFailed" 
                        ManualUpload="false" MultipleFileSelection="Disabled" MaxFileInputsCount="1" MaxFileSize="5000000" width="220px">
    <FileFilters>
        <telerik:FileFilter Description="Documents(pdf;tiff;tif)" Extensions="pdf,tiff,tif" />
    </FileFilters>
    <Localization Select="Browse" />
</telerik:RadAsyncUpload>

I'm filtering pdf and tiff documents only, but when I click Browse/Select in RadAsyncUpload it shows all the files in the directory when i use chrome.

Please advice. Thanks!


Hristo Valyavicharski
Telerik team
 answered on 09 Sep 2015
1 answer
120 views

Hi

I have used fitler in Telerik Radgrid.My telerik Version is 2015.1.401.40 . But the filter is not showing any items.

Below is the code which is rendered in browser. As you can text span text is empty.

<ul class="rmActive rmVertical rmGroup rmLevel1" style="transition:none; top: 0px; float: left; display: block; visibility: visible;">
    <li class="rmItem rmFirst"><a class="rmLink rmImageOnly rmFocused" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem "><a class="rmLink rmImageOnly" style="width: 86px;" href="#"><span class="rmText"></span></a></li><li class="rmItem rmLast" style="margin: 0px; padding: 0px; height: 0px; overflow: hidden;"><a class="rmLink" style="width: 86px; display: none;" href="#"><span class="rmText"></span></a></li>
   </ul>

Can you kindly help me out what may be the issue.

I have used Bootstarp Theme .

Eyup
Telerik team
 answered on 09 Sep 2015
3 answers
106 views

Hi,

As you can also see from the following Demo page, space doesn't work in the search box within RadNavigation. The search box doesn't allow space to be entered and this is a problem as it doesn't let me search using a combination of keywords (ex: "telerik controls"). Please help as we are using the search box in RadNavigation control.

 http://demos.telerik.com/aspnet-ajax/navigation/functionality/server-side-templates/defaultcs.aspx?product=navigation

 

Thanks,

Suresh

Plamen
Telerik team
 answered on 09 Sep 2015
3 answers
192 views
Hi.

I have an issue with modal radWindow, the thing is that I am using a master page, and it has obviusly an MainContent ContentPlaceHolder, the issue is when I show the window in modal style, the window "locks" the entire page, and I want to know if it's possible to configure the window to lock just the ContentPlaceHolder instead of the entire Page.

Hope you can help me, thanks.
Marin Bratanov
Telerik team
 answered on 09 Sep 2015
1 answer
90 views

I have two RadPanelItems in a RadPanelBar.

 The First  RadPanelItem has list of Controls and it goes up to 20 lines of controls. But when it is viewed in the browser all the 20 lines of controls are not visible due to the height which is set as AUTO is not reflected. Vertical scroll bar is shown to view the all the lines. I don't want to have the scroll bar, Instead i need to show all the lines of code at a single page.

 

Magdalena
Telerik team
 answered on 09 Sep 2015
1 answer
162 views

I get the following error when not using embedded scripts for the RadListBox

Uncaught TypeError: Cannot read property 'Classic' of undefined.

I'm using Telerik version 2015.1.225.40.

Sample code

<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryPlugins.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Navigation.NavigationScripts.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.ListBox.RadListBoxScripts.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.TouchScrollExtender.js" />              
        </Scripts>
    </telerik:RadScriptManager>
<div>
    <telerik:RadListBox ID="lstPermitStatuses" Width="313px" Height="100px" runat="server" EnableEmbeddedScripts="False">
        <Items>
            <telerik:RadListBoxItem Text="Item1" runat="server" />
            <telerik:RadListBoxItem Text="Item2" runat="server" />
            <telerik:RadListBoxItem Text="Item3" runat="server" />
            <telerik:RadListBoxItem Text="Item4" runat="server" />
            <telerik:RadListBoxItem Text="Item5" runat="server" />
        </Items>
    </telerik:RadListBox>
</div>
</form>


Please let me know how this can be fixed without using embedded scripts.

Dimitar
Telerik team
 answered on 09 Sep 2015
2 answers
162 views

Hello,

 I have a datagrid1 which contains another datagrid2 inside a nestedviewtemplate. With datagrid2 I insert, update and delete records with the help of the different command events.

How is it possible to get the parent item inside the OnItemCommandEvent, if I click on "Add new record" or on the button inside my GridEditCommandColumn. I tried e.Item.OwnerTableView.ParentItem inside the OnItemCommand-event, but the ParentItem is always null. Thanks in advance.

Kind regards,
Felix

Felix
Top achievements
Rank 1
 answered on 09 Sep 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?