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

cannot create an object of type'System.String[]' from its string represenation 'ID' fo the 'datakeynames'

3 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 12 Aug 2008, 12:07 PM
Hi..
I'm getting the following error when I try and view my grid in 'desgin' mode.

'Error Creating Control'
cannot create an object of type'System.String[]' from its string represenation 'ID' fo the 'datakeynames'


any ideas ?
thanks

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 12 Aug 2008, 12:32 PM
Hello Jon,

Please paste the declaration of your RadGrid here in order to be able to examine it and thus give you appropriate answer.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jon
Top achievements
Rank 1
answered on 12 Aug 2008, 12:57 PM
thanks


<telerik:RadGrid ID="RadGridCorrespondence" runat="server" AllowPaging="True" AllowSorting="True"

GridLines="None" Skin="Office2007"

AutoGenerateEditColumn = "False"

Width="972px" ShowFooter="True"

ShowStatusBar="True" SkinID="Web20" AutoGenerateColumns="False"

onitemcommand="RadGridCorrespondence_ItemCommand">

<PagerStyle AlwaysVisible="True" />

<

MasterTableView DataKeyNames="ID">

<CommandItemTemplate>

<a href="#" onclick="return ShowInsertForm();">View Message</a>

</CommandItemTemplate>

 

<

RowIndicatorColumn>

<

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

</

RowIndicatorColumn>

<

ExpandCollapseColumn>

<

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

</

ExpandCollapseColumn>

<Columns>

<telerik:GridBoundColumn DataField="INDEX" UniqueName="column" Visible="False">

<ItemStyle Width="50px" />

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="FROM" HeaderText="Name"

UniqueName="column1">

<ItemStyle Width="250px" />

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="SUBJECT" HeaderText="Subject"

UniqueName="column2">

<ItemStyle Width="250px" />

</telerik:GridBoundColumn>

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

UniqueName="column3">

<ItemStyle Width="250px" />

</telerik:GridBoundColumn>

<telerik:GridButtonColumn FooterText="" DataTextFormatString="Reply E-mail"

UniqueName="column1" HeaderText="Select<br/>" CommandName="EMAIL"

DataTextField="ID">

</telerik:GridButtonColumn>

<telerik:GridButtonColumn FooterText="" DataTextFormatString="Reply Letter"

UniqueName="column1" HeaderText="Select<br/>" CommandName="LETTER"

DataTextField="ID">

</telerik:GridButtonColumn>

</Columns>

<AlternatingItemStyle BackColor="Aqua" />

<CommandItemTemplate>

<div style="padding:10px 0px;">

Custom command item template

&nbsp;

<

asp:LinkButton Style="vertical-align: bottom" ID="btnEditSelected" runat="server"

CommandName

="EditSelected" CausesValidation="false" Visible='<%# RadGridCorrespondence.EditIndexes.Count == 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/Edit.gif" /> Edit Selected Products</asp:LinkButton>

<asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# RadGridCorrespondence.EditIndexes.Count > 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/Update.gif" /> Update Products</asp:LinkButton>

&nbsp;

<asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" CausesValidation="false" Visible='<%# RadGridCorrespondence.EditIndexes.Count > 0 || RadGridCorrespondence.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/Cancel.gif" /> Cancel editing</asp:LinkButton>

&nbsp;

<asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# !RadGridCorrespondence.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/AddRecord.gif" /> Add new Product</asp:LinkButton>

<asp:LinkButton ID="LinkButton3" runat="server" CommandName="PerformInsert" Visible='<%# RadGridCorrespondence.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/Insert.gif" /> Add this Product</asp:LinkButton>

&nbsp;

<

asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected Products?')"

runat

="server" CommandName="DeleteSelected" CausesValidation="false"><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/Delete.gif" /> Delete Selected Products</asp:LinkButton>

&nbsp;&nbsp;&nbsp;

<asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/Refresh.gif" /> Refresh Products</asp:LinkButton>

</div>

<a href="#" onclick="return ShowInsertForm();">View Message</a>

</CommandItemTemplate>

 

</

MasterTableView>

<clientsettings allowcolumnsreorder="True"

reordercolumnsonclient="True">

<selecting allowrowselect="True" />

<scrolling allowscroll="True" usestaticheaders="True" />

</clientsettings>

</telerik:RadGrid>

0
Daniel
Telerik team
answered on 14 Aug 2008, 02:31 PM
Hello Jon,

I failed to reproduce this issue using the code you provided. Please take a look at the attached screenshot and the source file and let us know if you find any discrepancies.

Additionally I tried to use Google in order to find out a possible reason for this error but I was unable to find a satisfying answer regardless of the number of results.

You can send us the whole project (via support ticket) or alternatively you can try to put the attached aspx into your website and let us know whether the issue still persists.

Kind regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Jon
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Jon
Top achievements
Rank 1
Share this question
or