Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
134 views

when i was doing client side paging and changed the page size in the radgrid at runtime, it is throwing error at
var link = item.get_cell(“Project”).getElementsByTagName(“a”)[0]; as
Uncaught TypeError: Cannot set property ‘innerHTML’ of undefined.

I totally have 3 rows to be binded in the grid. If i set pagesize in the aspx as 10 and then change the pagesize at run time to 20 it works.

But if i set the pagesize in aspx as 1 and later change the pagesize in the runtime to 10 it’s not working.
 

ASPX:

<telerik:RadGrid ID="RadGrid1" Skin="Office2007" runat="server"
   GridLines="None" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="false" PageSize="1">
   <ClientSettings>
       <ClientEvents OnCommand="RadGrid1_Command" OnRowDataBound="OpenSurveys_OnRowDataBound" />
   </ClientSettings>
   <MasterTableView>
     <Columns>
       <telerik:GridBoundColumn DataField="ProjectID"  HeaderText="ProjectID" Visible="False" />
       <telerik:GridBoundColumn DataField="SurveyPriority" HeaderText ="Priority" DataType="System.String"/>
       <telerik:GridHyperLinkColumn DataTextField="SurveyName" DataNavigateUrlFields="SurveyName"
                        UniqueName="Name" HeaderText="Name" ItemStyle-Font-Underline="true" />
       <telerik:GridBoundColumn DataField="SurveyCompletionStatusForPanelist" HeaderText="Completion Status" DataType="System.String" />
       <telerik:GridBoundColumn DataField="SurveyClosingDate" HeaderText="Due Date"  DataFormatString="{0:d}"/>
       <telerik:GridBoundColumn DataField="AdditionalInfo" HeaderText ="Additional Information"  />
     </Columns>
     </MasterTableView>
     <PagerStyle AlwaysVisible="true" />
    </telerik:RadGrid>

CS:

function OpenSurveys_OnRowDataBound(sender, args)
        {   
            console.log("hyperlink");
            // manually set the hyperlink's title
            var item = args.get_item();
            var dataItem = args.get_dataItem();
            var link = item.get_cell("Name").getElementsByTagName("a")[0];   
            console.log("item,dataItem,link",item,dataItem,link);
          
            link.innerHTML = dataItem.SurveyName;
            link.href = dataItem.SurveyURL;
           
        }

 

function pageLoad(sender, args)
    {
      document.getElementById("<%=RadGrid1.ClientID%>").style.display="block";
      document.getElementById("<%=RadGrid2.ClientID%>").style.display="none"; 
      OpenSurveysTableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
      $find("<%= RadAjaxLoadingPanel1.ClientID %>").show("<%= RadGrid1.ClientID %>");
      commandName = "Load";
      executeMethod("/WebServices/SurveyDetails.asmx", "OpenSurveys", getOpenSurveysRequestData(OpenSurveysTableView), updateOpenSurveyGrid, updateFailed);
    }
    function RadGrid1_Command(sender, args)
    {
      console.log("RadGrid1_Command");     
      args.set_cancel(true);
      commandName = args.get_commandName();
      console.log("commandName",commandName);
      $find("<%= RadAjaxLoadingPanel1.ClientID %>").show("<%= RadGrid1.ClientID %>");
      executeMethod("/WebServices/SurveyDetails.asmx", "OpenSurveys", getOpenSurveysRequestData(OpenSurveysTableView), updateOpenSurveyGrid, updateFailed);
    }
function updateOpenSurveyGrid(result)
    {
       //alert(result);
     
       $find("<%= RadAjaxLoadingPanel1.ClientID %>").hide("<%= RadGrid1.ClientID %>");
       console.log("updateOpenSurveyGrid", result);
       OpenSurveysTableView.set_dataSource(result);
       OpenSurveysTableView.dataBind();
      
       if (commandName == "PageSize" || commandName == "Load" || commandName == "Page") {
       console.log("paging");
             executeMethod("/WebServices/SurveyDetails.asmx", "GetOpenSurveyCount", "{}", updateOpenSurveyVirtualItemCount);
        }
    }
 function updateOpenSurveyVirtualItemCount(result)
    {
      OpenSurveysTableView.set_virtualItemCount(result);
    }
 function getOpenSurveysRequestData(OpenSurveysTableView)
    {
      console.log("getOpenSurveysRequestData", OpenSurveysTableView)
      var openpageSize = OpenSurveysTableView.get_pageSize();
      var opencurrentPageIndex = OpenSurveysTableView.get_currentPageIndex();
      var openstartIndex = openpageSize * opencurrentPageIndex;
      //console.log("openpageSize,opencurrentPageIndex,openstartIndex,OpenSurveysTableView.get_pageSize()",openpageSize,opencurrentPageIndex,openstartIndex,OpenSurveysTableView.get_pageSize())
      return JSON.stringify({
      "startIndex": openstartIndex,
      "maximumRows": OpenSurveysTableView.get_pageSize(),
      "sortExpression": '',
      "filterExpression": ''
       });
      
    }
 function executeMethod(location, methodName, methodArguments, onSuccess, onFail)
    {
      //console.log("executeMethod", location, methodName, methodArguments, onSuccess, onFail);
      $.ajax({
      type: "POST",
      url: location + "/" + methodName,
      data: methodArguments,
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: onSuccess,
      fail: onFail
      });
    }

kavitha
Top achievements
Rank 1
 answered on 26 Apr 2011
2 answers
34 views
I have a grouped grid where user can select the whole group or just some groupmembers. If the whole group is selected, the groupitems shouldn't be displayed. If only one or more groupmembers are selected, the group should be expanded.

So I used this code (simplified):

SortedList

 

<string, GridGroupHeaderItem> headerItems = new SortedList<string, GridGroupHeaderItem>();

 


protected
void rtl_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridGroupHeaderItem)
            {
                GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item;
                  
                headerItems.Add(groupDataRow["Betriebegruppe"].ToString(), item);
  
            }
            else if (e.Item is GridItem)
            {
                GridItem item = (GridItem)e.Item;
                  
                item.Selected = dataBase.checkIsItemSelected(item);
                        
                if (item.Selected && !headerItems[dataRow.Betriebegruppe].Expanded)
                {                   
                    headerItems[dataRow.Betriebegruppe].Expanded = true;
                }
            }
        }

Now, if the headerItems[...].Expanded is set to true, the group expands, but all items which are added after this assignment are set to style="display:none" and are only visible if I collapse and expand in client.

How can I fix this behavior?
Torsten
Top achievements
Rank 1
 answered on 26 Apr 2011
2 answers
117 views
Hi, I have looked quite hard at what you have on line and a working recurrence sample seems to be absent. If I am wrong - wonderful - please point me to it, but otherwise I am trying to just see this work in a dirt simple way. I have this XML

<?xml version="1.0" encoding="utf-8"?>
<Appointments>
  <Appointment>
    <ID>3</ID>
    <Subject>testing 123</Subject>
    <Description>testing</Description>
    <Start>2011-04-23T10:30Z</Start>
    <End>2011-04-23T11:30Z</End>
    <RecurrenceRule><![CDATA[DTSTART:20110423T103000Z
DTEND:20110423T113000Z
RRULE:FREQ=WEEKLY;UNTIL=20120424T000000Z;INTERVAL=52;BYDAY=TU
]]></RecurrenceRule>
  </Appointment>
</Appointments>

I am attaching to this as follows

Protected Overrides Sub OnInit(ByVal e As EventArgs)
        MyBase.OnInit(e)
        RadScheduler1.Provider = New XmlSchedulerProvider(Server.MapPath("~/App_Data/Appointments.xml"), True)
    End Sub

What I would like to see is anything at all show up in the scheduler. Its not clear from the documentation as to how to make this work. Thanks.
Karl Wilkens
Top achievements
Rank 1
 answered on 26 Apr 2011
1 answer
46 views
For Version Q1 2011 released 04/13/2011, changing the RadControlExamples Grid/Examples/GeneralFeatures/GridRatingColumn/DefaultVB.aspx grid which contains a GridRatingColumn to autopostback, it only works if precision=Item or not specified.   if half or exact, the autopostbackonfilter is ignored (although double-click causes a postback).

This works fine in the demo if selecting the rating to filter:
</telerik:GridBoundColumn>
                 <telerik:GridRatingColumn DataField="Rating"
                    HeaderText="Rating" AutoPostBackOnFilter="true" ShowFilterIcon="true" 
                     CurrentFilterFunction="GreaterThanOrEqualTo" 
                     CurrentFilterValue="0.0" Precision="Item"  FilterDelay="2000" 
                   FilterListOptions="AllowAllFilters">
                     <HeaderStyle Width="250px" />
                 </telerik:GridRatingColumn>

This does not postback:
<telerik:GridRatingColumn DataField="Rating" HeaderText="Rating" AutoPostBackOnFilter="true" ShowFilterIcon="true" 
                      CurrentFilterFunction="GreaterThanOrEqualTo" 
                      CurrentFilterValue="0.0" Precision="Half"  FilterDelay="2000"  FilterListOptions="AllowAllFilters">
                      <HeaderStyle Width="250px" />
</telerik:GridRatingColumn>

Maria Ilieva
Telerik team
 answered on 26 Apr 2011
3 answers
79 views
Hi Experts,

I am encountering error. Please see attached snap shot of error.
When I create any appointment via advance insert form it shows me error. When I add appointment from basic insert form it does not show me error, but when I edit any appointment it also gives me same error.
I am unable to add/edit any appointment.

I have master page and radAjaxLoadingPanel, radAjaxPanel placed on my aspx page.
It seems to be a scripting error.....or might be a telerik dll issue that is not referencing properly.

Regards,
Mohsin Jawaid
Veronica
Telerik team
 answered on 26 Apr 2011
4 answers
246 views
Hello,

I have a UserControl with different fields and a RadComboBox. I want to reduze the time that the user needs to wait (actually the RadComboBox is populated on server-side and it takes a lot of time).

The content of the RadComboBox is not required immediatly; the user needs to fill some fields before. I want to use a WebService or HttpHandler to fill the RadComboBox asynchronously and make it completly "invisible" for the user.

I found some solutions to load the items using a WebService/WCF but the request is sent only when the user try to display the RadComboBox's content (LoadOnDemand)!

Is there a solution to call the WebService automatically after the page load without an interaction of the user?

Thank you for your help.
Quantesys IT
Top achievements
Rank 1
 answered on 26 Apr 2011
1 answer
92 views
Hello,
I have a SharePoint Server 2010 site which use the rad menu control. The problem I'm facing is that this controls are disturbing inline editing OOTB fuctionality. Within any custom list, if you group the elemments by any field and inline editing is enabled in the view, when you try to expand the group, items don't get displayed. That's a strange behavior. You can overcome this problem showing groups expanded by default, by this is not what I need.

Thanks in advance.
F.
Kate
Telerik team
 answered on 26 Apr 2011
1 answer
125 views
Hello,

I am trying to apply a filter on initial load but continue to get an error. I have followed this example http://www.telerik.com/help/aspnet-ajax/grdapplyingdefaultfilteroninitialload.html which seems pretty simple but I get an error: "Expression expected",.. "Exception Details: System.Web.Query.Dynamic.ParseException: Expression expected". Any help would be great.

Thanks

<%@ Page Title="" Language="C#" MasterPageFile="~/MBA/MBA.master" AutoEventWireup="true"
    CodeFile="ProgramMembers.aspx.cs" Inherits="MBA_ProgramMembers" %>
 
<%@ Register Src="../Controls/AddPersonModal.ascx" TagName="AddPersonModal" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="NestedContent" runat="Server">
    <script type="text/javascript">
        function OpenPositionedWindow(oButton, url, windowName) {
            var oWnd = window.radopen(url, windowName);
        }
        function openRadWindow(HNUMBER) {
            var oWnd = window.open("StudentFolder.aspx?HNUMBER=" + HNUMBER, "RadWindow1", "WindowPopup", "width=400px, height=400px, resizable");
            oWnd.center();
        }
 
    </script>
    <div id="programMembersGrid">
        <telerik:RadGrid ID="rgMBAProgramMembers" runat="server" AllowFilteringByColumn="True"
            AllowPaging="True" AllowSorting="True" DataSourceID="ldsMBAProgramMembers" GridLines="None"
            CellSpacing="0" EnableLinqExpressions="false">
            <ClientSettings>
                <Selecting AllowRowSelect="True" />
            </ClientSettings>
            <MasterTableView AutoGenerateColumns="False" DataSourceID="ldsMBAProgramMembers"
                FilterExpression="([Active] = True)">
                <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="HNUMBER" DataType="System.Int32" FilterControlAltText="Filter HNUMBER column"
                        HeaderText="HNUMBER" SortExpression="HNUMBER" UniqueName="HNUMBER" Visible="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="BANNER_ID" FilterControlAltText="Filter BANNER_ID column"
                        HeaderText="Anumber" SortExpression="BANNER_ID" UniqueName="BANNER_ID" AutoPostBackOnFilter="false"
                        CurrentFilterFunction="equalto" FilterDelay="4000" ShowFilterIcon="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FullName" FilterControlAltText="Filter FullName column"
                        HeaderText="Name" SortExpression="FullName" UniqueName="FullName" AutoPostBackOnFilter="false"
                        CurrentFilterFunction="Contains" FilterDelay="4000" FilterControlWidth="150"
                        ShowFilterIcon="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ProgramName" FilterControlAltText="Filter ProgramName column"
                        HeaderText="Program" SortExpression="ProgramName" UniqueName="ProgramName" AllowFiltering="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="MemberTypes" FilterControlAltText="Filter MemberTypes column"
                        HeaderText="MemberTypes" SortExpression="MemberTypes" UniqueName="MemberTypes"
                        AllowFiltering="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="Active" DataType="System.Boolean" HeaderText="Active"
                        UniqueName="Active" AutoPostBackOnFilter="true" ShowFilterIcon="false" AllowSorting="true"
                        CurrentFilterFunction="EqualTo" CurrentFilterValue="True">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridTemplateColumn ItemStyle-Width="20px" HeaderStyle-Width="20px" FooterStyle-Width="20px">
                        <ItemTemplate>
                            <a href="#" onclick="openRadWindow('<%#DataBinder.Eval(Container.DataItem,"HNUMBER")%>'); return false;">
                                <asp:Image ID="iFolder" runat="server" ImageUrl="~/App_Themes/Huntsman/Grid/Folder.png"
                                    Style="border: none; border-width: 0" /></a>
                        </ItemTemplate>
                        <FilterTemplate>
                            Show All
                            <asp:ImageButton ID="btnShowAll" runat="server" ImageUrl="~/App_Themes/Huntsman/Grid/filterCancel.gif"
                                AlternateText="Show All" ToolTip="Show All" OnClick="btnShowAll_Click" Style="vertical-align: middle" />
                        </FilterTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
        </telerik:RadGrid>
    </div>
    <telerik:RadWindowManager ID="RadWindowManager1" Width="1020px" Height="1170px" EnableShadow="true"
        VisibleOnPageLoad="true" RestrictionZoneID="folderContainer" runat="server">
    </telerik:RadWindowManager>
    <asp:LinqDataSource ID="ldsMBAProgramMembers" runat="server" ContextTypeName="DAL.HuntsmanLinqDataContext"
        EntityTypeName="" TableName="vw_MBAProgramMembers">
    </asp:LinqDataSource>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgMBAProgramMembers">
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="ldsMBAProgramMembers">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgMBAProgramMembers" />
                    <telerik:AjaxUpdatedControl ControlID="ldsMBAProgramMembers" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
</asp:Content>
-----------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
public partial class MBA_ProgramMembers : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void btnShowAll_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {
        rgMBAProgramMembers.MasterTableView.FilterExpression = string.Empty;
 
        foreach (GridColumn column in rgMBAProgramMembers.MasterTableView.RenderColumns)
        {
            if (column is GridBoundColumn)
            {
                GridBoundColumn boundColumn = column as GridBoundColumn;
                boundColumn.CurrentFilterValue = string.Empty;
            }
        }
 
        this.
        rgMBAProgramMembers.MasterTableView.Rebind();
    }
}

Pavlina
Telerik team
 answered on 26 Apr 2011
1 answer
87 views
Hi.. 
How to set the cssclass attribute while inserting the textbox control in radeditor..?
Rumen
Telerik team
 answered on 26 Apr 2011
1 answer
124 views

I just wanted to find out if it's possible to disable image resizing in the Design mode of the Telerik:RadEditor?

Rumen
Telerik team
 answered on 26 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?