This is a migrated thread and some comments may be shown as answers.

Destination array is not long enough

3 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Darren
Top achievements
Rank 1
Darren asked on 05 Feb 2008, 01:27 AM
I am getting an error when I try to bind the radgrid promethius. I had this working in the asp.net radgrid version, but decided to upgrade to the most current version of promethius. Thanks

Error: Destination array is not long enough to copy all the items in the collection. Check array index and length. 

<%

@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"

CodeFile="ClassPickNew.aspx.vb" Inherits="ClassPickNew" EnableViewStateMac="false"

EnableEventValidation="false" MaintainScrollPositionOnPostback="true" %>

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<%

@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

Namespace="System.Web.UI" TagPrefix="asp" %>

<

asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

<

telerik:RadGrid ID="rgMain" Skin="Outlook2007" runat="server" AllowPaging="False"

AllowSorting="True" AllowMultiRowSelection="false" AutoGenerateColumns="False"

OnItemCommand="rgMain_ItemCommand" HorizontalAlign="NotSet" AllowAutomaticDeletes="False"

AllowAutomaticInserts="False" AllowAutomaticUpdates="false" Width="100%" AllowFilteringByColumn="false"

ShowGroupPanel="False">

<ClientSettings ReorderColumnsOnClient="True" AllowColumnsReorder="True" ApplyStylesOnClient="True">

<Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="1"

ScrollHeight="300px"></Scrolling>

<Resizing AllowRowResize="True" ClipCellContentOnResize="False" AllowColumnResize="True">

</Resizing>

</ClientSettings>

<MasterTableView DataKeyNames="ClassID" GridLines="None" AllowMultiColumnSorting="True"

AutoGenerateColumns="False" HorizontalAlign="NotSet" CommandItemDisplay="Top">

<GroupByExpressions>

<telerik:GridGroupByExpression>

<SelectFields>

<telerik:GridGroupByField FieldAlias="ClassDate" FieldName="ClassDate" FormatString="{0:D}"

HeaderText="Classes Offered"></telerik:GridGroupByField>

<telerik:GridGroupByField FieldAlias="StartTime" FieldName="StartTime" FormatString="{0:hh:mm tt}"

HeaderText=" "></telerik:GridGroupByField>

</SelectFields>

<GroupByFields>

<telerik:GridGroupByField FieldName="ClassDate" SortOrder="Ascending"></telerik:GridGroupByField>

<telerik:GridGroupByField FieldName="StartTime" SortOrder="Ascending"></telerik:GridGroupByField>

</GroupByFields>

</telerik:GridGroupByExpression>

</GroupByExpressions>

<Columns>

<telerik:GridBoundColumn HeaderText="ClassSchedulingID" DataField="ClassSchedulingID"

SortExpression="ClassSchedulingID" UniqueName="ClassSchedulingID" Display="False"

ReadOnly="True">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="SlotCode" SortExpression="SlotCode" HeaderText="SlotCode"

DataField="SlotCode" Display="False" ReadOnly="True">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="ClassTitleFull" SortExpression="ClassTitleFull"

HeaderText="Class" DataField="ClassTitleFull">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="ClassDate" SortExpression="ClassDate" HeaderText="ClassDate"

DataField="ClassDate" DataFormatString="{0:M/dd}">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn UniqueName="StartTime" SortExpression="StartTime" HeaderText="StartTime"

DataField="StartTime" DataFormatString="{0:hh:mm tt}">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="HandsOn" HeaderText="HandsOn" SortExpression="HandsOn"

UniqueName="HandsOn">

</telerik:GridBoundColumn>

<telerik:GridTemplateColumn UniqueName="Segment" HeaderText="Segment">

<ItemTemplate>

<%

--<asp:Label ID="lblSegment" runat="server"></asp:Label>--%>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridBoundColumn UniqueName="ClassFull" SortExpression="ClassFull" HeaderText="ClassFull"

DataField="ClassFull">

</telerik:GridBoundColumn>

<telerik:GridButtonColumn CommandName="Details" Text="Details" UniqueName="Details">

</telerik:GridButtonColumn>

<telerik:GridButtonColumn UniqueName="Select" Text="Select" CommandName="Select">

</telerik:GridButtonColumn>

</Columns>

<ExpandCollapseColumn ButtonType="ImageButton" Visible="true" UniqueName="ExpandColumn">

<HeaderStyle Width="19px"></HeaderStyle>

</ExpandCollapseColumn>

<RowIndicatorColumn ItemStyle-Width="0px" HeaderStyle-Width="0px" />

<CommandItemTemplate>

</CommandItemTemplate>

</MasterTableView>

</telerik:RadGrid>

</

asp:Content>

----------------------------------------------------

Imports

System.Data.SqlClient

Imports

System.Data

Imports

Telerik.Web.UI


Sub

BindAvailableClasses()

Dim strConnection As String = ConfigurationManager.ConnectionStrings("MCHPEvents").ConnectionString

Dim cnMain As New SqlConnection(strConnection)

Try

Dim cmdMain As New SqlCommand("pr_Event_ListClassSchedulingInfo", cnMain)

cmdMain.CommandType = CommandType.StoredProcedure

cmdMain.Parameters.Clear()

cmdMain.Parameters.Add(

New SqlParameter("@EventTypeID", SqlDbType.Int))

cmdMain.Parameters(

"@EventTypeID").Value = oUser.EventID

'cmdMain.Parameters.Add(New SqlParameter("@SlotCode", SqlDbType.Int))

'cmdMain.Parameters("@SlotCode").Value = SlotCode

cmdMain.Parameters.Add(

New SqlParameter("@ReturnOnePerClassGroup", SqlDbType.Bit))

cmdMain.Parameters(

"@ReturnOnePerClassGroup").Value = 0

cmdMain.Parameters.Add(

New SqlParameter("@EventPart", SqlDbType.Int))

cmdMain.Parameters(

"@EventPart").Value = Convert.ToInt16(ConfigurationManager.AppSettings("MastersEventPart"))

Dim daMain As New SqlDataAdapter(cmdMain)

Dim dsMain As New DataSet

daMain.Fill(dsMain,

"Main")

rgMain.DataSource = dsMain.Tables(

"Main")

rgMain.DataMember =

"Main"

rgMain.DataBind()

Catch ex As SystemException

Finally

'Cleanup

If cnMain.State = ConnectionState.Open Then

cnMain.Close()

End If

cnMain.Dispose()

End Try

End Sub



3 Answers, 1 is accepted

Sort by
0
Darren
Top achievements
Rank 1
answered on 05 Feb 2008, 01:39 AM
I just found out that if I remove the grouping it works - so it is the grouping that is causing a problem for some reason. Also, the skin mentioned about should be 'Outlook' and not 'Outlook2007'. Thanks.
0
Sebastian
Telerik team
answered on 05 Feb 2008, 09:15 AM
Hello Darren,

Do you experience this issue with the latest version Q3 2007 SP1 of RadControls Prometheus? If the issue is still there after applying the hotfix, I suggest you prepare a stripped working version of your project and send it attached to a formal support ticket. I will examine your code implementation in detail and will get back to you with more info.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Darren
Top achievements
Rank 1
answered on 05 Feb 2008, 04:16 PM
Hi, I was able to get it working. As mentioned it is fixed in sp1. For some reason the automatic installation of this package did not overwrite my version 1218 dll's. I tried a few times and same problem. So, I downloaded the hotfix dll's and all is good.

Thanks.
Tags
Grid
Asked by
Darren
Top achievements
Rank 1
Answers by
Darren
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or