Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
388 views
Trying this simple example to use paging and sorting  when using when using NeedDataSource event

My example is base on this online live demo:
http://www.telerik.com/demos/aspnet/prometheus/Grid/Examples/Programming/NeedDataSource/DefaultCS.aspx

(I am using this version :RadControls_for_ASP.NET_AJAX_2008_1_515_dev.exe)

Strangly my code is very similar but somehow when i start sorting and paging i either get an empty page or and eroor like this :

Index 15 is either negative or above rows count. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Index 15 is either negative or above rows count.

Strange because the live demo while using very similar code, work but not my code!

Here my example, you can see its pretty close to the live demo (see the previous link)


.cs:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
               
            }
        }

        protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            DataTable table = new DataTable();
            table.Columns.Add("FirstName", typeof(string));
            table.Columns.Add("LastName", typeof(string));

            table.Rows.Add(new object[] { "Joe1","Brown1"});
            table.Rows.Add(new object[] { "Joe2", "Brown2" });
            table.Rows.Add(new object[] { "Joe3", "Brown3" });
            table.Rows.Add(new object[] { "Joe4", "Brown4" });
            table.Rows.Add(new object[] { "Joe5", "Brown5" });
            table.Rows.Add(new object[] { "Joe6", "Brown6" });
            table.Rows.Add(new object[] { "Joe7", "Brown7" });
            table.Rows.Add(new object[] { "Joe8", "Brown8" });
            table.Rows.Add(new object[] { "Joe9", "Brown9" });
            table.Rows.Add(new object[] { "Joe10", "Brown10" });
            table.Rows.Add(new object[] { "Joe11", "Brown11" });
            table.Rows.Add(new object[] { "Joe12", "Brown12" });
            table.Rows.Add(new object[] { "Joe13", "Brown13" });
            table.Rows.Add(new object[] { "Joe14", "Brown14" });
            table.Rows.Add(new object[] { "Joe15", "Brown15" });
            table.Rows.Add(new object[] { "Joe16", "Brown16" });
            table.Rows.Add(new object[] { "Joe17", "Brown17" });
            table.Rows.Add(new object[] { "Joe18", "Brown18" });
            table.Rows.Add(new object[] { "Joe19", "Brown19" });
            table.Rows.Add(new object[] { "Joe20", "Brown2" });
           
            table.Rows.Add(new object[] { "Jane1", "Smith1" });
            table.Rows.Add(new object[] { "Jane2", "Smith2" });
            table.Rows.Add(new object[] { "Jane3", "Smith3" });
            table.Rows.Add(new object[] { "Jane4", "Smith4" });
            table.Rows.Add(new object[] { "Jane5", "Smith5" });
            table.Rows.Add(new object[] { "Jane6", "Smith6" });
            table.Rows.Add(new object[] { "Jane7", "Smith7" });
            table.Rows.Add(new object[] { "Jane8", "Smith8" });
            table.Rows.Add(new object[] { "Jane9", "Smith9" });
            table.Rows.Add(new object[] { "Jane10", "Smith10" });
            table.Rows.Add(new object[] { "Jane11", "Smith11" });
            table.Rows.Add(new object[] { "Jane12", "Smith12" });
            table.Rows.Add(new object[] { "Jane13", "Smith13" });
            table.Rows.Add(new object[] { "Jane14", "Smith14" });
            table.Rows.Add(new object[] { "Jane15", "Smith15" });
            table.Rows.Add(new object[] { "Jane16", "Smith16" });
            table.Rows.Add(new object[] { "Jane17", "Smith17" });
            table.Rows.Add(new object[] { "Jane18", "Smith18" });
            table.Rows.Add(new object[] { "Jane19", "Smith19" });
            table.Rows.Add(new object[] { "Jane20", "Smith2" });

            RadGrid1.DataSource = table;
           

        }

     

       
    }
}

.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

    <telerik:RadGrid ID="RadGrid1" Skin="Office2007" Width="97%" AllowSorting="True"
        PageSize="15" ShowFooter="True" AllowPaging="True" AllowMultiRowSelection="True"
        runat="server" GridLines="None" OnNeedDataSource="RadGrid1_NeedDataSource">
        <MasterTableView Width="100%" />
        <PagerStyle Mode="NextPrevAndNumeric" />
    </telerik:RadGrid>
    </form>
</body>
</html>

Can anyone help on this matter ?

VANDENBERGHE
Top achievements
Rank 1
 answered on 09 Jun 2008
4 answers
202 views
Hi,

I have an aspx page with a RADToolTipManager containing the AJAXUpdate. The OnAjaxUpdate Sub fires ok and subsequently calls UpdateToolTip.

In my UpdateToolTip Sub, I dynamically load my UserControl - which I can also debug and this is working also.

My problem is that the tooltip is always empty. The tooltip displays for a few seconds and then disappears without having shown anything.

I have changed my usercontrol to contain only a static image and it still will not display.

If I try and use a sqldatarepeater, dynamically populated from the code behind, I cannot reference the controls on my aspx as I get a "Object is not set to an instance of an object" error - something to do with the event order I think.

I have tried following the online example by using a datasource on the aspx page and although I get no errors, still nothing is displayed.

Am I missing something? Any help much appreciated, this is driving me crazy.

Regards,

Steve
Svetlina Anati
Telerik team
 answered on 09 Jun 2008
4 answers
137 views
Hi All,

I'm using the RadEditor within a TemplateColumn as detailed out in the documentation. That part works great. My problem is that I've extended the tools shown to include the LinkManager. Clicking the icon does invoke it, but the dialog is messed up visually and mostly hidden from view.

Anyone else had this problem? Is there a restriction on using the Dialog based managers?

Thanks for your help,

Clyde
George
Telerik team
 answered on 09 Jun 2008
1 answer
142 views
Hi,

I need to build a tab strip which the data source is a SiteMapDataSource, but Ajaxfied. I've tried RadAjaxPanel, and RadAjaxManager, but both with no success.

Where can I find an example of how to do this?

I intend to use it on a master page.
Poul Henningsen
Top achievements
Rank 1
 answered on 09 Jun 2008
1 answer
142 views
I'm looking for a way to use the datePicker and display the date as a weeknumber in the DateInput field. To be precisely, the format I need is weeknumber + year (wwyy). So, no way there is a datetime format I can use!
Is there any way to get such a result to display to the user?
 
I already tried the clientEvent "OnPopupClosing", but I can't figure out a way to set the correct format into the DateInput field.

Can anybody help me with this?
Maria Ilieva
Telerik team
 answered on 09 Jun 2008
1 answer
83 views
How can I define padding or spacing between calendars when I use MultiColumns? Here is my Calendar:
                <telerik:RadCalendar ID="RadCalendar1"   
                    runat="server"   
                    Skin="Office2007" 
                    AutoPostBack="true" 
                    EnableMultiSelect="false" 
                    MultiViewColumns="3" 
                    MultiViewRows="1">  
                </telerik:RadCalendar>              
 
It looks awful the way it's set by default. Whene using Office2007 as Skin, I can't see where one calendar ends and the next starts.
Dimo
Telerik team
 answered on 09 Jun 2008
3 answers
170 views
Hi,

I want to use only normal DropDownList inside my RagGridViews instead of RadCombobox, How can I set  The DropDownControlType="DropDownList" parameter by default ?

For Example in the Web.Config File Or with a Skin?

Anyone know if this is possible ?

Thanks.
Yavor
Telerik team
 answered on 09 Jun 2008
5 answers
192 views
I am looking for a way to clone, or dynamically create a doc item when I drag a control onto a doc zone.  I saw an example somewhere of this being used with rad controls, but I can't figure a way to do this.  As an example, I want to be able to drag something from a toolbox and have a raddoc be created where I drop it.

Is there any way to achieve this?

Thank you
Obi-Wan Kenobi
Top achievements
Rank 1
 answered on 09 Jun 2008
3 answers
267 views
How can I show raddock in the middle of user screen?

Regrads

J
james
Top achievements
Rank 2
 answered on 09 Jun 2008
1 answer
173 views

I have two problems:

1. I'm hiding the panel in which my RadGrid resides, and I show it once a certain LinkButton has been clicked. The problem is when I click the LinkButton to display the panel the first time, the NeedDataSource-event is not triggered. When I click the same button a second time (in succession to the first click), the event is triggered and the RadGrid is filled with data. Doing MyGrid.Rebind() works, but it feels like an ugly solution, seeing how it should bind it automatically?

I heard I could do EnableOutsideScripts="true" but I can't find that property anywhere! I must be dead stupid, I've looked for this property all over yet I can't find it. I have to ask - is it deprecated? According to the object browser, RadAjaxManager inherits from RadAjaxControl, which in turn has the property according to the site (but not according to my object browser). Intellisense isn't picking it up, and manually typing it does no good.

2. I'm binding varying datasources to another RadGrid depending on a set of variables I store in ViewState, this resulted in broken paging on the RadGrid. I read something about ViewState conflicts, but I didn't quite understand how the RadGrid ViewState could interfere with the rest of the page's ViewState.

I'm using the latest version of Teleriks RadControls and .NET Framework 3.5. Tips?

Sebastian
Telerik team
 answered on 09 Jun 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?