Error: "A field or property with the name is not found on the selected data source" Get only on server
Up vote
4
Down vote
Favorite
2
I publish my project without any warning on local IIS and it works correctly (Localhost/[myprojectname]). So, I upload them-to-server with cute ftp. But the server I get this error apear for all my filed like [TableName]. [Filedname]:
A field or property with the name ' Confirmstatuse.name ' is not found on the selected data source
Here ' s My Code:
<asp:gridview id= "ordergv" runat= "Server" datakeynames= "ID" autogeneratecolumns= "False" datasourceid= " Summaryofordersrc "allowsorting=" True "
<columns>
<asp:commandfield selecttext=" select " showselectbutton= "True" buttontype= "button"/>
<asp:boundfield datafield= "OrderId"/>
<asp: BoundField datafield= "Confirmstatuse.name"/>
<asp:boundfield datafield= "Orderstatuse.name"/>
< Asp:boundfield datafield= "Paymentstatuse.name"/>
<asp:boundfield datafield= "ShipmentStatuse.Name"/>
<asp:templatefield;
<itemtemplate>
<asp:label id= "Createddatelabel" runat= "Server" Text= ' <%# getpersiandate (Eval ("CreatedDate"))%> '/></itemtemplate>
</asp:templatefield>
</columns>
</asp:gridview>
<asp:linqdatasource id= "SUMMARYOFORDERSRC" runat= "Server" Contexttypename= " Ahooratech.DAL.DataClasses1DataContext "Entitytypename=" "orderby=" createddate desc "tablename=" Orders ">
</asp:LinqDataSource>
I Check the size of my project in local IIS and on server. Both of them is same (8,459,009 bytes)
So it means I use same database and same files for run my application for run on local and server. So why am I get this error only in server?
The only difference are on version of IIS, I think my server for IIS version is 7.0. But was it important for I get this error?!!! I don ' t think so. I ' m really confused.
(My local project and server project use same connection string).
Edit:i Publish project on another host and it works! But it's doesn ' t work on my original server yet.
ASP. net-4.0 iis-7.5 sql-server-2012
Shareimprove this question
Edited June at 6:26
Asked June at 5:30
Mohammadreza
97441434
Resulting LINQ Query object doesn ' t has the property given. What exactly are not clear for? Error message is pretty straight forward. –abatishchev June at 5:39
1
Hi Dear, I have this property in my result query. The error message is pretty clear and why it's work on local and not work on server. I Check the all things. All thing is same. @abatishchev –mohammadreza June "at 5:46
Okay, I see. Hmm. Maybe you has a silly but hidden mistake in deployment:are you sure you ' ve copied the app properly and assemblies weren ' T cached? Double check. And try to delete the Temp ASP. NET Files folder. –abatishchev June at 5:51
Yes. I also delete all of them files and publish them. They is exactly same is size, even in bytes 8,459,009 bytes. I ' m really confused @abatishchev. What thing can I ask or search for this error?! –mohammadreza June at 6:04
1
I too am have this issue. I have complete control over both my local and the Web server environments and has assured that Code/database is all IDE Ntical. This definitely seems to is a version issue. – John Bledsoe Sep "at 20:50
Show 4 more comments
2 Answers
Activeoldestvotes
Up vote
6
Down vote
This is the same issue to the one described here-binding to Navigation property causes "A field or property with the NA Me ' x.x ' is not found on the selected data source "in IIS 6 only
It appears to is an issue with the BoundField control element. As suggested in an answer provided by user Anant in the article linked above, you can convert the BoundField to a Template Field and it'll work (using the "Orderstatuse.name" in your example). That's solution worked for me.
Although this really doesn ' t explain what IIS6 can ' t support the BoundField in this the.
Mind boggling.
Shareimprove this Answer
answered Feb 6 ' at 15:40
Jameshough
6113
Thank you Much–mohammadreza Feb 8 ' in 6:19
Add a Comment
Did you find this question interesting? Try our Newsletter
Newsletter and get our top new questions delivered to your Inbox (see an example).
Email address
Subscribe
Up vote
2
Down vote
Accepted
I found the IIS Version on my server is 6. But my local is 7.5. I publish my project on another server with IIS 7.5 and it works
SOLUTION1:I Create a summaryoforder like this:
Class Summaryoforder
{
public int Id {get; set;}
public int OrderId {get; set;}
public string Confirmstatusname {get; set;}
public string Orderstatusname {get; set;}
public string Paymentstatusname {get; set;}
public string Shippingstatusname {get; set;}
public string CreatedDate {get; set;}
}
and change
<asp:boundfield datafield= "Confirmstatuse.name"/>
To
<asp:boundfield datafield= "Confirmstatusname"/>
and bind class to Grid by
Gv.datasource = Mysummryoforder;
Gv.databind ();
and initialize a list of this type and bind it to grid programmatically
Update Solution 2 Convert
Asp:boundfield
To
Asp:templatefield and using
<%# Eval ("Worker.fullname")%>
Shareimprove this Answer
Edited at 18:35
Seva Alekseyev
36.3k1379172
answered June at 6:58
Mohammadreza
97441434
That's got it working after trying for long time! But don ' t know why issue is occurring after deployed on different server, it is working correctly with BoundField on my Local. Is it because I had. NET 4.5 on my machine which had EF 6 where as Deployment server had. NET 4 and probably with EF6? –altaf Patel Sep ' at 10:27
I ' m not sure but think it's because of [email Protected]–mohammadreza Sep] at 2:23
Both machines had IIS 6.1, except later had SP2. @Mohammadreza –altaf Patel Sep at 6:34
[Go]---Error: "A field or property with the name is not found on the selected data source" Get only on server