PDA

View Full Version : [CLOSED] Error with Mapping property on Store



marco.morreale
Dec 07, 2012, 5:05 PM
Hi,
I can't get the mappingName property work.
In debug I see "new_Famiglia.Name" has got a value but I got this error: "Run-time Error of Microsoft JScript: 'new_Famiglia.Name' is null or is not an object" (see image with Italian error message).
5256
The "IncidentId" field is displayed.
Where am I wrong?

I can't send a working example as my data source is Microsoft CRM OData protocol.

Please, can you help me?
Thanks in advance
Marco

.aspx


<ext:GridPanel ID="gpTicketMonitor"
runat="server"
Title="Ticket Monitor"
>
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="IncidentId" />
<ext:ModelField Name="new_Famiglia" Mapping="new_Famiglia.Name" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column runat="server" Text="IncidentId" DataIndex="IncidentId" />
<ext:Column runat="server" Text="new_Famiglia" DataIndex="new_Famiglia" />
</Columns>
</ColumnModel>
</ext:GridPanel>


WebService Method


[WebMethod]
public DataServiceCollection<Incident> getIncident_List()
{
DataServiceCollection<Incident> IncidentCollection;

var query = from c in _context.IncidentSet
where c.IncidentId == new Guid("c63d4f0e-7340-e211-90fe-00155dde0185")
select new Incident
{
IncidentId = c.IncidentId,
new_Famiglia = c.new_Famiglia
};

IncidentCollection = new DataServiceCollection<Incident>();
IncidentCollection.Load(query);

return IncidentCollection;
}



.cs


protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
DataWebService wsData = new DataWebService();

this.Store1.DataSource = wsData.getIncident_List();

this.Store1.DataBind();
}

}

RCN
Dec 07, 2012, 5:42 PM
Can you provide a running example? Which is the type of source variable?

marco.morreale
Dec 07, 2012, 9:42 PM
Hi RCN,
I am sorry but I can't provide a running example.
My data source is Microsoft Dynamics CRM and I can't include it in a sample.

Anyway code seems pretty simple. Can you see anything wrong in it?
Should I use IsComplex property on "ext:ModelField " to refer the Name property?

Thanks in advance.
M

marco.morreale
Dec 07, 2012, 10:05 PM
I found the solution.

I should use "ServerMapping" instead of "Mapping".

Thank you anyway.
You can mark as closed.
M