Telerik Forums
UI for ASP.NET AJAX Forum
14 answers
662 views

Hi,

I've been having problems with client side calculations for my RadGrid (EditMode="Batch", EditType="Cell").

In order to sum up cells 'a' and 'b' and display the result in cell 'c' of the selected row (and only this row) I subscribed to OnBatchEditCellValueChanged event and created javascript function (see below).

It worked fine in 2014.403.45.

When switching to the latest (2014.2.618.40) and changing to EditType="Row" (it doesn't work for "Cell" also) all of a sudden I get loads of undefined/null object errors:

Error: Unable to get value of the property 'getElementsByTagName': object is null or undefined

Callstack:
​ _getDataControl
 _openCellInEditMode
 openRowForEdit
 _open
 _openEditFromEvent
 Anonymous Function


I've spent hours researching this and still didn't manage to get this working...

I guess my question would be: could you please provide an example of a simple javascript function example that sums two cells and display the result in the third
cell of the selected row in RadGrid with EditMode="Batch", EditType="Cell".

Thank you in advance.

function BatchCellModified(sender, args) {
              var grid = $find('<%= myGrid.ClientID %>');
              var masterTable = grid.get_masterTableView();
              var rows = masterTable.get_dataItems();
              var rowArgs = args.get_row();
              var rowIndex = rowArgs.sectionRowIndex;
              var row = rows[rowIndex];
              var txtTotal = row.get_cell("Total");
        
              if (args.get_columnUniqueName() === "PD" ||
                  args.get_columnUniqueName() === "BI") {
        
                  var txtPd = (isNaN(parseFloat(row.get_cell("PD").outerText))) ? 0 : parseFloat(row.get_cell("PD").outerText);
                  var txtBi = (isNaN(parseFloat(row.get_cell("BI").outerText))) ? 0 : parseFloat(row.get_cell("BI").outerText);
        
                  var totalAmount = txtPd + txtBi;
                  txtTotal.innerHTML = totalAmount;
              }
              if (args.get_columnUniqueName() === "Total") {
                  if (txtTotal != (txtPd + txtBi)) {
                      var txtPdOutput = row.get_cell("PD");
                      txtPdOutput.innerHTML = 0;
                      var txtBiOutput = row.get_cell("BI");
                      txtBiOutput.innerHTML = 0;
                  }
              }
          };
Angel Petrov
Telerik team
 answered on 14 Aug 2015
1 answer
97 views
Right now I have a radcontext menu in my radgrid that has Replace, Edit and Delete options. When delete is clicked, it opens a RadWindow. I have a radtextbox and a raddatepicker that need to fill the corresponding data from the radgrid upon Page_Load. Can anyone help? My issue is not knowing how to pull that data from the Default page.
Eyup
Telerik team
 answered on 14 Aug 2015
1 answer
197 views

We have similar two radgrids like below in one page. When we try to insert empty data clicking on insert it shows requiredfiled validator which is correct but it triggers requiredfield validator of 2nd grid also because it is also in edit mode. How to keep it separate so that validation for one grid should not call validation for 2nd grid if both are in edit/Insert mode.

 

<telerik:RadGrid ID="c_dgvMClassificationCode" AllowPaging="true" PageSize="5" AllowCustomPaging="true"
        runat="server"AllowFilteringByColumn="False"GridLines="None"AutoGenerateColumns="False"
        AllowSorting="True">
        <PagerStyle Visible="true"/>
        <ClientSettings AllowColumnsReorder="True"ReorderColumnsOnClient="True"EnableRowHoverStyle="True">
            <ClientEventsOnRowContextMenu="RowContextMenuMClassificationCode"/>
            <ScrollingAllowScroll="true"EnableVirtualScrollPaging="false" UseStaticHeaders="true"
                SaveScrollPosition="true"/>
            <SelectingAllowRowSelect="true"/>
        </ClientSettings>
        <GroupingSettingsCaseSensitive="false"/>
        <MasterTableViewDataKeyNames="UniqueID"NoMasterRecordsText="No Master Classification Codes found."
            EditMode="InPlace"CommandItemDisplay="Top"GridLines="Both"TableLayout="Fixed"
            InsertItemPageIndexAction="ShowItemOnCurrentPage" Width="490">
            <CommandItemTemplate>
                <divstyle="width: 80%; float: left; vertical-align: middle; height: 23px;">
                    <asp:Label ID="c_lblMclsCode"runat="server"Text="Master Classification Code" CssClass="gridHeaderLabels"></asp:Label>&nbsp;
                    <asp:ImageButton ID="c_ibtnAdd"CssClass="headerButtons"runat="server"ImageUrl="~/Images/addDocBtn.png"
                        CommandName="InitInsert1"ImageAlign="Middle"CausesValidation="false"></asp:ImageButton>
                    &nbsp;
                </div>
            </CommandItemTemplate>
            <Columns>
                <telerik:GridTemplateColumnSortAscImageUrl="~/App_Themes/Default/Grid/Skins/Vista/SortAsc.gif"
                    AllowFiltering="false"FilterImageUrl="~/App_Themes/Default/Grid/Skins/Vista/Filter.gif"
                    HeaderStyle-Width="30"UniqueName="UniqueID"SortDescImageUrl="~/App_Themes/Default/Grid/Skins/Vista/SortDesc.gif">
                    <ItemStyleHorizontalAlign="Center"VerticalAlign="Middle"Wrap="False"Width="30">
                    </ItemStyle>
                    <ItemTemplate>
                        <asp:ImageButton ID="c_ibtnActionMenu"runat="server"ImageUrl="~/Images/actionIcon.png"/>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridEditCommandColumnUniqueName="EditCommandColumn"HeaderStyle-Width="30px"
                    ButtonType="ImageButton"EditImageUrl="~/Images/actionIcon.png"CancelImageUrl="~/App_Themes/Default/Grid/Skins/Vista/cancelIcon.png"
                    UpdateImageUrl="~/App_Themes/Default/Grid/Skins/Vista/updateIcon.png"InsertImageUrl="~/App_Themes/Default/Grid/Skins/Vista/updateIcon.png">
                </telerik:GridEditCommandColumn>
                <telerik:GridBoundColumn ReadOnly="True"SortAscImageUrl="~/App_Themes/Default/Grid/Skins/Vista/SortAsc.gif"
                    DataField="UniqueID"FilterImageUrl="~/App_Themes/Default/Grid/Skins/Vista/Filter.gif"
                   DataType="System.Int32"UniqueName="UniqueID"SortDescImageUrl="~/App_Themes/Default/Grid/Skins/Vista/SortDesc.gif"
                    HeaderText="UniqueID"Display="false"Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumnUniqueName="IndustryCodeDescription"HeaderText="Master Classification Code">
                    <ItemStyleHorizontalAlign="Left"VerticalAlign="Bottom"Wrap="True"></ItemStyle>
                    <ItemTemplate>
                        <%--<%#DataBinder.Eval(Container.DataItem, "IndustryCodeDescription")%>--%>
                        <img alt="Primary"src="~/images/TransparentdashSaveIcon.png"runat="server"id="imgPrimary"
                            style="border: 0px; padding: 0 5px 0 5px;"visible="false"/>
                        <asp:Literal ID="ltlIndustryCode"runat="server"Text='<%# DataBinder.Eval( Container, "DataItem.IndustryCodeDescription") %>' />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadComboBox DataTextField="Description"DataValueField="IndustryCodeID"
                            ID="c_dgvrcbIndustryCodes"runat="server"Width="400px"EnableScreenBoundaryDetection="false"
                            Filter="Contains"MarkFirstMatch="false"ExpandDirection="Down"EmptyMessage="--Select One--"
                            CssClass="inputRequired"EnableTextSelection="true"EnableItemCaching="true"
                            EnableLoadOnDemand="true">
                        </telerik:RadComboBox>
                        <br />
                        <asp:RequiredFieldValidatorID="rfvrcbIndustryCode"runat="server"ControlToValidate="c_dgvrcbIndustryCodes"
                            ErrorMessage="Please Select Master Classification Code" ForeColor="red" Display="Dynamic"
                            SetFocusOnError="True"></asp:RequiredFieldValidator>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="IndustryCodeID"DataType="System.Int32"UniqueName="IndustryCodeID"
                    HeaderText="IndustryCodeID"Display="false"Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="IsPrimary"DataType="System.Int32"UniqueName="IsPrimary"
                    HeaderText="IsPrimary"Display="false"Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="EntityID"DataType="System.Int32"UniqueName="EntityID"
                    HeaderText="EntityID"Display="false"Visible="false">
                </telerik:GridBoundColumn>
            </Columns>
            <PagerTemplate>
                <asp:Panel ID="c_pnlPager"Style="padding: 1px;" runat="server"HorizontalAlign="Center">
                    <p style="margin: 0px; padding: 0px;">
                        <asp:ImageButton ID="c_ibtnPagingFirst"ImageUrl="~/App_Themes/Default/Grid/Skins/Vista/img/PagingFirst.gif"
                            runat="server"OnClick="c_ibtnPagingFirst_click"ImageAlign="Middle"CommandName="Page"
                            CommandArgument="First"/>
                        <asp:ImageButton ID="c_ibtnPagingPrev" ImageUrl="~/App_Themes/Default/Grid/Skins/Vista/img/PagingPrev.gif"
                            runat="server"OnClick="c_ibtnPagingPrev_click"ImageAlign="Middle"CommandName="Page"
                            CommandArgument="Prev" />
                        <span style="vertical-align: middle;">Page:</span> <span style="vertical-align: middle;">
                            <%# CType(DataBinder.Eval(Container, "Paging.CurrentPageIndex"), Int32) + 1 %>&nbsp;</span>
                        <span style="vertical-align: middle;">of
                            <%# DataBinder.Eval(Container, "Paging.PageCount")%>
                        </span>
                        <asp:ImageButton ID="c_ibtnPagingNext_click"ImageUrl="~/App_Themes/Default/Grid/Skins/Vista/img/PagingNext.gif"
                            runat="server"OnClick="c_ibtnPagingNext_click"ImageAlign="Middle"CommandName="Page"
                            CommandArgument="Next"/>
                        <asp:ImageButton ID="c_ibtnPagingLast" ImageUrl="~/App_Themes/Default/Grid/Skins/Vista/img/PagingLast.gif"
                            runat="server"OnClick="c_ibtnPagingLast_Click"ImageAlign="Middle"CommandName="Page"
                            CommandArgument="Last"/>
                    </p>
                </asp:Panel>
            </PagerTemplate>
        </MasterTableView>
    </telerik:RadGrid>

Eyup
Telerik team
 answered on 14 Aug 2015
3 answers
445 views

Hi,

In my aspx, I have tried setting 'AllowedFileExtensions='.xls,.xlsx' and <FileFilters><FileFilter Exntensions='xls,xlsx'> but neither seem to have any effect - please advise.

Dimitar
Telerik team
 answered on 14 Aug 2015
2 answers
174 views

 It will still run but when I throw the exceptions i get this when I click insert new item:

System.ArgumentNullException occurred
  _HResult=-2147467261
  _message=Value cannot be null.
  HResult=-2147467261
  IsTransient=false
  Message=Value cannot be null.
Parameter name: value
  Source=mscorlib
  ParamName=value
  StackTrace:
       at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureParameter)
  InnerException: 

Eyup
Telerik team
 answered on 14 Aug 2015
3 answers
216 views
I have a RadGrid where the columns are autogenerated based on the DataSet.  I need to check if one of the columns exists, I would like to make that column filtered by a combobox or a dropdown.I have a RadGrid where the columns are autogenerated based on the DataSet.  I need to check if one of the columns exists, I would like to make that column filtered by a combobox or a dropdown.I have a RadGrid where the columns are autogenerated based on the DataSet.  I need to check if one of the columns exists, I would like to make that column filtered by a combobox or a dropdown.

ASPX
<telerik:RadGrid ID="rgApplications" runat="server" AllowSorting="True" AutoGenerateColumns="False" AllowPaging="True" GridLines="None" Width="100%" CellSpacing="0">
    <MasterTableView DataKeyNames="ExecutedDocumentId,TemplateId,ParentId" ClientDataKeyNames="ExecutedDocumentId,TemplateId,ParentId" AutoGenerateColumns="true" AllowFilteringByColumn="true">
        <EditFormSettings EditFormType="Template">
            <EditColumn UniqueName="EditColumn">
            </EditColumn>
            <FormTemplate>
                <div style="padding-bottom: 5px; padding-top: 5px; padding-left: 20px;">
                    <b><%# (Container is GridEditFormInsertItem) ? GetResource("Add") : GetResource("Edit") %></b>
                    <table border="0" cellpadding="2" width="100%">
                        <tr>
                            <td nowrap>
                                <asp:Label ID="lblType" runat="server" resourcekey="Type" AssociatedControlID="ddlType" />:
                            </td>
                            <td nowrap align="left" style="padding-left: 5px">
                                <asp:DropDownList ID="ddlType" Width="340px" MaxLength="120" runat="server" />
                                <span style="color: Red; padding-left: 2px; padding-right: 3px; font-size: larger">*</span>
                                <asp:RequiredFieldValidator ID="rfvType" ControlToValidate="ddlType" InitialValue="0"
                                    ValidationGroup="UpdateApplications" runat="server" ErrorMessage="Required" ForeColor="Red" />
                            </td>
                        </tr>
                    </table>
                    <p>
                        <asp:ImageButton ID="btnSaveApplications" runat="server" ValidationGroup="UpdateApplications" resourcekey="Save" CommandName="SaveApplication" />
                          
                        <asp:ImageButton ID="btnCancelApplications" runat="server" resourcekey="Cancel" CommandName="Cancel" />
                    </p>
                </div>
            </FormTemplate>
        </EditFormSettings>
        <CommandItemSettings ShowRefreshButton="false" ShowAddNewRecordButton="true" />
        <Columns>
            <telerik:GridClientSelectColumn UniqueName="SelectApplication" HeaderTooltip="Select All" />
            <telerik:GridButtonColumn UniqueName="DeleteDocument" CommandName="DeleteDocument" ButtonType="ImageButton" ShowFilterIcon="false" />
            <telerik:GridButtonColumn UniqueName="ViewDocument" CommandName="ViewDocument" ButtonType="ImageButton" ShowFilterIcon="false" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>


Code Behind
void rgApplications_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
    // Make Document Status Filter A DropDown
    if (e.Column.UniqueName == "DocumentStatus")
    {
        GridBoundColumn bCol = e.Column as GridBoundColumn;
        if (bCol != null)
        {
            Data.TaxonomyFilteringTemplate template = new MyFilteringTemplate(e.Column.UniqueName, "Document Status", rgApplications);
            bCol.FilterTemplate = template;
            bCol.CurrentFilterFunction = GridKnownFunction.EqualTo;
        }
    }
}

MyFilterTemplate
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace MyTestProgram
{
    public class MyFilteringTemplate : ITemplate
    {
        protected DropDownList combo;
        private string colname;
        private string lookupName;
        RadGrid radgrid;
 
        public TaxonomyFilteringTemplate(string cName, string lookup, RadGrid grid)
        {
            colname = cName;
            lookupName = lookup;
            radgrid = grid;
        }
 
        public void InstantiateIn(Control container)
        {
            combo = new DropDownList();
            combo.ID = "RadComboBoxControl";
            container.Controls.Add(combo);
            combo.AutoPostBack = true;
            //combo.EnableViewState = false;
            combo.SelectedIndexChanged += combo_SelectedIndexChanged;
 
            combo.Items.Add(new ListItem("Please Select"));
 
            var dt = MyController.GetLookupList(this.lookupName);
            var dvOptions = new DataView(dt);
            dvOptions.Sort = "Name";
             
 
            foreach (DataRow dr in dvOptions.ToTable().Rows)
            {
                combo.Items.Add(new ListItem(dr["Name"].ToString()));
            }
 
        }
 
        void combo_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddl = sender as DropDownList;
            string filterExpression = string.Empty;
            if (ddl.Text != "")
                filterExpression = "([" + colname + "] = '" + ddl.Text + "')";
            radgrid.MasterTableView.FilterExpression = filterExpression;
            radgrid.MasterTableView.Rebind();
        }
    }
}


The problem I am having is that I am getting an exception:

Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.

Any suggestion on how to solve this?
Eyup
Telerik team
 answered on 14 Aug 2015
12 answers
526 views
How can I get a radeditor to fill out the full content area of a radpane? I've tried setting the radeditor's width and height properties to 100% but this does not work.

The radeditor does not have any modules defined and has just a basic set of tools.
Adam
Top achievements
Rank 1
 answered on 14 Aug 2015
4 answers
380 views
Hi,
I was checking Telerik UI for ASP.NET AJAX Q1 2014 trial version.
I need custom paging with sorting and filtering using Stored Procedure.

i found that RadGrid filters already filtered data on its own. if custom paging is used, obviously sorting and filtering done in Stored Procedure.

is there any way to stop Radgrid to filter data on its own somthing like FilterMode="Custom" ?
Mick
Top achievements
Rank 1
 answered on 14 Aug 2015
3 answers
196 views

Hello Support,

​We are experiencing very sluggish rendering behavior when using Rad Editor Control in Rad Window when browsed from IE browser.
Please find few image screenshots to explain the issue.

Test environment:
Telerik version: 2015.1.401.45
Chrome: 44.0.2403.130
IE: 11.0.9600.17905

It seems that page CSS files are being retrieved multiple times from the server in all browsers but in IE, files are retrieved twice or more than twice. Hence slows down the whole page in IE browser.


Brief information about existing application (I don’t think it is related to Kentico environment which we are using):

  • user control (deployed as Kentico webpart) which is added to Kentico Page
  • has RadGrid for listing items.
  • editing item from the grid, pop-ups Rad Window.
  • Rad Window has editable form fields along with 7 Rad Editors

 

Investigation so far:

  • Remove rad Editors from the rad window – No duplication of the CSS files
  • Specified “EditorCssFile” as well as “CssClasses” – Still retrieves CSS files

Need your help to fix the rendering/retrieving difference between browsers as well as any workaround to stop retrieving CSS files multiple times.

Please let me know if you need any other information.

 

Thanks.

 

Isolated page code:

.aspx 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RadEditor_RadWindow_PageStyle.Default" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
    <link href="Content/Site.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="scmScriptManager" runat="server"></asp:ScriptManager>
 
                <asp:Button ID="btnOpen" runat="server" Text="Open" OnClick="btnOpen_Click" />
 
                <telerik:RadWindow ID="radWindow" runat="server" Modal="true" Behaviors="Close" AutoSize="true"
                    Title="radWindow1">
                    <ContentTemplate>
                        <p>Rad Editor 1</p>
                            <telerik:RadEditor ID="RadEditor1" runat="server" Width="600px" Height="300px"
                                EditModes="Design" Visible="false">
                                 
                            </telerik:RadEditor>
                        <p>Rad Editor 2</p>
                        <telerik:RadEditor ID="RadEditor2" runat="server" Width="600px" Height="300px"
                                EditModes="Design" Visible="false">
                            </telerik:RadEditor>
                    </ContentTemplate>
                </telerik:RadWindow>
        </div>
    </form>
</body>
</html>

 .aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace RadEditor_RadWindow_PageStyle
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
        protected void btnOpen_Click(object sender, EventArgs e)
        {
            radWindow.VisibleOnPageLoad = true;
        }
    }
} 

chintan
Top achievements
Rank 1
 answered on 13 Aug 2015
4 answers
315 views
Hi Telerik Team, I have this gauge

<telerik:RadRadialGauge runat="server" ID="RadRadialGauge1" Width="300px" Height="300px">
     <Pointer Value="10">
          <Cap Size="0.1" />
     </Pointer>
     <Scale Min="0" Max="100" MajorUnit="10"/>
</telerik:RadRadialGauge>

I'm changing the pointer value in the code behind with this command:
RadRadialGauge1.Pointer.Value = 50;

The initial value of the pointer is 10, but when I call the command to set the value to 50, the pointer goes to zero and than after goes to 50.
I want that the pointer begin in 10 and go immediately to 50.

Thanks,
Gustavo

Rafael
Top achievements
Rank 1
 answered on 13 Aug 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?