Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
320 views
I am having a problem in using the RadListView with a nested RadGrid and the RadDataPager. Basically when the page loads it works fine, but as soon as I click on the pager to advance to the next page I get the following error.

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Line 64: 
Line 65:         row = dt.NewRow();
Line 66: row["Id"] = (int)parentItem.GetDataKeyValue("Id");Line 67:         row["Description"] = "One";
Line 68:         dt.Rows.Add(row);

I have tried for a while now to figure out what is wrong. What I see is the rgPriorActualVolumeValues_NeedDataSource being called twice with the error occuring on the second call. Here is some simple sample code I created. I am using RadControls v. 2010.3.1215.40. Thanks in advance.

ASPX Page

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <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.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
   
    <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="Default">
    </telerik:RadSkinManager>
  
<table align="center" width="99%" style="table-layout:fixed">
    <tr>
        <td>
            <telerik:RadListView ID="rlvForecastCardView_Item" runat="server" Width="100%" 
                AllowPaging="true" ItemPlaceholderID="ItemHolder" 
                DataKeyNames="Id"
                PageSize="1"
                onneeddatasource="rlvForecastCardView_Item_NeedDataSource">
                <LayoutTemplate>
                    <asp:Panel ID="ItemHolder" runat="server" />
                    <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="rlvForecastCardView_Item"
                        PageSize="1">
                        <Fields>
                            <telerik:RadDataPagerButtonField FieldType="FirstPrev" />
                            <telerik:RadDataPagerButtonField FieldType="Numeric" />
                            <telerik:RadDataPagerButtonField FieldType="NextLast" />
                            <telerik:RadDataPagerTemplatePageField>
                                <PagerTemplate>
                                    <div style="float: right">
                                        <b>Items
                                            <asp:Label runat="server" ID="CurrentPageLabel" Text="<%# Container.Owner.StartRowIndex+1%>" />
                                            to
                                            <asp:Label runat="server" ID="TotalPagesLabel" Text="<%# Container.Owner.TotalRowCount > (Container.Owner.StartRowIndex+Container.Owner.PageSize) ? Container.Owner.StartRowIndex+Container.Owner.PageSize : Container.Owner.TotalRowCount %>" />
                                            of
                                            <asp:Label runat="server" ID="TotalItemsLabel" Text="<%# Container.Owner.TotalRowCount%>" />
                                            <br />
                                        </b>
                                    </div>
                                </PagerTemplate>
                            </telerik:RadDataPagerTemplatePageField>
                        </Fields>
                    </telerik:RadDataPager>
  
                </LayoutTemplate>
                <ItemTemplate>
                    <table class="ContentTableBordered TableFullWidth" cellspacing="0" cellpadding="4">
                        <tr>
                            <td class="tableSectionLabelCell"><asp:Literal ID="lIdLabel" runat="server" Text="ID"></asp:Literal></td>
                            <td class="tableSectionLabelCell"><asp:Literal ID="lDescriptionLabel" runat="server" Text="Description"></asp:Literal></td>
                        </tr>
                        <tr>
                            <td class="tableSectionDataCell"><%# Eval("Id") %></td>
                            <td class="tableSectionDataCell"><%# Eval("Description") %></td>
                        </tr>
                    </table>                
                    <br />
                    <table class="ContentTableBordered TableFullWidth" cellspacing="0" cellpadding="4">
                        <tr>
                            <td width="33%">
                                <telerik:RadGrid ID="rgPriorActualVolumeValues" runat="server" 
                                    AllowFilteringByColumn="False" 
                                    AllowPaging="False" 
                                    AllowSorting="false"
                                    ClientSettings-AllowColumnHide="false" 
                                    AutoGenerateColumns="False" 
                                    ShowGroupPanel="false"
                                    ShowFooter="true"
                                    EnableHeaderContextMenu="false"
                                    ViewStateMode="Disabled"
                                    onneeddatasource="rgPriorActualVolumeValues_NeedDataSource">
                                <MasterTableView
                                    CommandItemDisplay="None">
                                <RowIndicatorColumn>
                                <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn>
                                <HeaderStyle Width="20px"></HeaderStyle>
                                </ExpandCollapseColumn>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="Id" HeaderText="Id" UniqueName="Id">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Description" HeaderText="Description" UniqueName="Description">
                                    </telerik:GridBoundColumn>
                                 </Columns>
                                <NoRecordsTemplate>
                                <asp:Label ID="lblNoTotalsRecords" runat="server" CssClass="LabelBold" Text="No records for the filtering selections you have chosen."></asp:Label>
                                </NoRecordsTemplate>
                                </MasterTableView>
                                </telerik:RadGrid>
                             
                            </td>
  
                        </tr>
  
                    </table>
  
  
                  
                </ItemTemplate>
            </telerik:RadListView>
        </td>
    </tr>
</table>
  
  
    </form>
</body>
</html>

Code Behind

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
  
public partial class Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
  
    }
  
    protected void rlvForecastCardView_Item_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
    {
        DataTable dt = new DataTable();
        DataRow row;
  
  
        dt.Columns.Add("Id", typeof(int));
        dt.Columns.Add("Description", typeof(string));
  
        row = dt.NewRow();
        row["Id"] = 1;
        row["Description"] = "One";
        dt.Rows.Add(row);
  
        row = dt.NewRow();
        row["Id"] = 2;
        row["Description"] = "Two";
        dt.Rows.Add(row);
  
        row = dt.NewRow();
        row["Id"] = 3;
        row["Description"] = "Three";
        dt.Rows.Add(row);
  
        row = dt.NewRow();
        row["Id"] = 4;
        row["Description"] = "Four";
        dt.Rows.Add(row);
  
        rlvForecastCardView_Item.DataSource = dt;
    }
  
    protected void rgPriorActualVolumeValues_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        RadGrid rgPriorActualVolumeValues = (RadGrid)source;
        var parentItem = rgPriorActualVolumeValues.NamingContainer as RadListViewDataItem;
  
  
        DataTable dt = new DataTable();
        DataRow row;
  
  
        dt.Columns.Add("Id", typeof(int));
        dt.Columns.Add("Description", typeof(string));
  
        row = dt.NewRow();
        row["Id"] = (int)parentItem.GetDataKeyValue("Id");
        row["Description"] = "One";
        dt.Rows.Add(row);
  
        row = dt.NewRow();
        row["Id"] = (int)parentItem.GetDataKeyValue("Id");
        row["Description"] = "Two";
        dt.Rows.Add(row);
  
        row = dt.NewRow();
        row["Id"] = (int)parentItem.GetDataKeyValue("Id");
        row["Description"] = "Three";
        dt.Rows.Add(row);
  
        row = dt.NewRow();
        row["Id"] = (int)parentItem.GetDataKeyValue("Id");
        row["Description"] = "Four";
        dt.Rows.Add(row);
  
  
  
        rgPriorActualVolumeValues.DataSource = dt;
    }
  
  
}


James Daresta
Top achievements
Rank 1
 answered on 12 Jan 2011
6 answers
196 views

When I click on RAD Telerik MVC Editor control spell check icon I get an error message "Spell Check Handler Server Error:500
System.Web.HttpException (0x80004005): A public action method 'Telerik.Web.UI.SpellCheckHandler.axd' was not found"

In web.config file i have declared httpHandler, but still it's not working

 

<

 

 

httpHandlers>
<add path="Telerik.Web.UI.DialogHandler.axd" verb="*" type="Telerik.Web.UI.DialogHandler" validate="false" /><add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/><add verb="*" validate="false" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI"/>
</
httpHandlers>

 

 

 

 

Please let me know if any solution for this problem.

Rumen
Telerik team
 answered on 12 Jan 2011
1 answer
92 views
Hi all,

I have a RadTreeView which I'm binding to a SiteMapDataSource. When I click on a node, it navigates to the page URL in the SiteMap. Normally, this would likely be the behavior that one would want. However, in my case, I'm trying to use the control to allow the user to modify the tree. I don't want the control to navigate to the URL corresponding to the node when the user clicks on the node. I just want them to select the node. Does anyone know if there is a way to prevent it from navigating? I'm guessing I'm running into this problem since I'm binding to a SiteMapDataSource. I was thinking maybe I could set a Handled property on the EventArgs to the NodeClick event to override the navigation, but, it doesn't look like that is supported.

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<telerik:RadTreeView ID="RadTreeView1" runat="server" 
    DataSourceID="SiteMapDataSource1" Height="200px" 
    onnodeclick="RadTreeView1_NodeClick">
</telerik:RadTreeView>

Jon
Yana
Telerik team
 answered on 12 Jan 2011
8 answers
509 views
Hello,

I am using a RadDatePicker Q12008

If I have it this way:
<telerik:RadDatePicker ID="rdpStartDate" runat="server">  
     <DateInput   
        ID="DateInput1" runat="server"   
        DateFormat="MMM yyyy" DisplayDateFormat="MMM yyyy">  
     </DateInput> 
</telerik:RadDatePicker> 
 

I select a date and it displays it fine  "Mar 2007"

But if I change the formats to " DateFormat="MM/yyyy" DisplayDateFormat="MM/yyyy"

No matter what date I select, it always shows the month as 09 (the current month).. the year is correct

"09/2007" instead of "03/2007"

Ultimate goal is I need to be able to have them pick month and yeah, no day.

Thanks,
Matt
Casey
Top achievements
Rank 1
 answered on 12 Jan 2011
2 answers
91 views
Hello

I'd like to restrict the max row length to a certain amount so the typed text wraps on the next line after this amount has been passed.

Regards
Mihai
Mihai Dinculescu
Top achievements
Rank 1
 answered on 12 Jan 2011
4 answers
254 views
Hi,

Any body suggest me how to open the rad window in normal style..

Open like a browser window [it should look like how we open the page using window.open.]

In my app i have a button.

While click on that button i have some conditions checks.

If it satisfies my particular condition i have to open one URL (some times internal page some times other website page )

in new window with out blocking by pop up blocker.


I tried with java script window.open it is blocked by pop up blocker.

So i tried with Rad window. It is opening but i need the look and feel as default browser.

Please suggest me how to proceed on this.

Thanks in Advance
Thenmozhi
Georgi Tunev
Telerik team
 answered on 12 Jan 2011
2 answers
70 views
In the Clicking event I'm trying to get the text of the button, but sender.get_text() is giving me an empty string

Button is defined like this
<telerik:RadButton ID="showInputButton" runat="server" ButtonType="StandardButton" ToggleType="CustomToggle" AutoPostBack="False" ForeColor="Black" CommandArgument='<%# Eval("pdrid") %>' OnClientClicking="OnToggleInputClicking">
                                <ToggleStates>
                                    <telerik:RadButtonToggleState PrimaryIconCssClass="rbAdd" Text="Show" />
                                    <telerik:RadButtonToggleState PrimaryIconCssClass="rbRemove" Text="Hide" />
                                </ToggleStates>
                            </telerik:RadButton>

Am I doing something wrong?
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
 answered on 12 Jan 2011
2 answers
72 views
Hi, i'm trying to validate the combobox using a customvalidator and a clienside validation function.
the problem is the validation function is not fired upon clicking the submit button.
it fires only when i change an item in the combbox.
So if i click submit button without changing an item no validation check happens.
How can i fix that?
Cori
Top achievements
Rank 2
 answered on 12 Jan 2011
2 answers
48 views
I have an app that we install at customer sites.  It builds a menu based on the user's application-level security settings.  We have a new customer that is running IE6 on their workstations.  The menu code that is getting generated looks like:

<Menu>
  <Group>
    <Item Text='Home' NavigateUrl='default.aspx' />
    <Item Text='Work Order Status' NavigateUrl='wosearch.aspx' />
    <Item Text='Device Info' NavigateUrl='devsearch.aspx' />
    <Item Text='Reports'>
      <Group>
        <Item Text='Inventory'>
          <Group>
            <Item Text='By Cost Center' NavigateUrl='rptInvByCostCtr.aspx' />
            <Item Text='By Description' NavigateUrl='rptInvByDevice.aspx' />
            <Item Text='By Manufacturer' NavigateUrl='rptInvByManf.aspx' />
          </Group>
        </Item>
        <Item Text='Work Orders'>
          <Group>
            <Item Text='CMs By Cost Center' NavigateUrl='rptWOByCostCtr.aspx' />
            <Item Text='PM Scheduling' NavigateUrl='rptPMScheduling.aspx' />
          </Group>
        </Item>
      </Group>
    </Item>
  </Group>
</Menu>

This works fine at the same site on computers running IE8, but on those running IE6 it works fine until you get to the second level (Reports > Inventory) but doesn't show the items that appear below that (By Cost Center, By Description, By Manufacturer).

Any ideas on how to fix this will be very greatly appreciated!
Steve LaForge
Top achievements
Rank 1
 answered on 12 Jan 2011
1 answer
226 views
Hi all,

I have a problem accessing the Item data from RadRotator.
I have created a custom control using RadRotator. I have an image and a Hyper link in my rad rotator.

<sf:RadRotator ID="ImageRotatorId" runat="server" RotatorType="AutomaticAdvance" WrapFrames= "true" Width="550px" Height="260px">
    <ItemTemplate>
            <div>
                <asp:Image runat="server" ID="newsImage" style = "width:550px; height:260px; "></asp:Image>
            </div>
            <div>
                <asp:HyperLink onclick ="toggleLocation()" runat= "server" id="caption" width ="550px">
                </asp:HyperLink>
            </div>
    </ItemTemplate>
</sf:RadRotator>
<panel id = "location_map" visible = "false"> </panel>

now I want to get the data associated with my image ($find('<%= ImageRotatorId.ClientID %>')).get_currentItem() gives me the current element but how to get the data associated with this element in my java script.


Thanks,
Mohit
Rumen
Telerik team
 answered on 12 Jan 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?