[转] --- Error: “A field or property with the name was not found on the selected data source” get only on server
Error: “A field or property with the name was 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 in server i get this error apear for all my filed like [tableName].[filedName]:
A field or property with the name 'ConfirmStatuse.Name' was 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 are 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 i get this error only in server?
The only difference here is on version of iis, i think my server iis version is 7.0. but is 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 doesn't work on my original server yet.
asp.net .net-4.0 iis-7.5 sql-server-2012
shareimprove this question
edited Jun 15 '13 at 6:26
asked Jun 15 '13 at 5:30
Mohammadreza
97441434
Resulting LINQ query object doesn't have the property given. What exactly is not clear for you? Error message is pretty straight forward. – abatishchev Jun 15 '13 at 5:39
1
hi dear, I have that property in my result query. error message is pretty clear but why it work on local but not work on server. I check the all things. all thing are same. @abatishchev – Mohammadreza Jun 15 '13 at 5:46
Okay, I see. Hmm. Maybe you have 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 Temp ASP.NET Files folder. – abatishchev Jun 15 '13 at 5:51
yes. i also delete all of them files and publish them. they are 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 Jun 15 '13 at 6:04
1
I too am having this issue. I have complete control over both my local and the web server environments and have assured that code/database are all identical. This definitely seems to be a version issue. – John Bledsoe Sep 26 '13 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 name 'X.X' was not found on the selected data source" in IIS 6 ONLY
It appears to be 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 TemplateField and it will work (using "OrderStatuse.Name" in your example). That solution worked for me.
Although this really doesn't explain why IIS6 can't support the BoundField in this way.
Mind boggling.
shareimprove this answer
answered Feb 6 '14 at 15:40
JamesHough
6113
thank you so much – Mohammadreza Feb 8 '14 at 6:19
add a comment
Did you find this question interesting? Try our newsletter
Sign up for our 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 Aug 26 at 18:35
Seva Alekseyev
36.3k1379172
answered Jun 15 '13 at 6:58
Mohammadreza
97441434
That got it working after trying for long time ! But don't know why issue was occurring after deployed on different server, it was working correctly with boundfield on my local. Is it because I have .NET 4.5 on my machine which has EF 6 where as deployment server had .NET 4 and probably with EF6 ? – Altaf Patel Sep 10 '14 at 10:27
I'm not sure but think it's because of IIS.@AltafPatel – Mohammadreza Sep 15 '14 at 2:23
Both machines had IIS 6.1, except later had SP2. @Mohammadreza – Altaf Patel Sep 16 '14 at 6:34
[转] --- Error: “A field or property with the name was not found on the selected data source” get only on server的更多相关文章
- MongoDB查询转对象是出错Element '_id' does not match any field or property of class
MongoDB查询转对象是出错Element '_id' does not match any field or property of class 解决方法: 1.在实体类加:[BsonIgno ...
- Mongodb:修改文档结构后出现错误:Element '***' does not match any field or property of class ***.
Mongodb:修改文档结构后出现错误:Element '***' does not match any field or property of class ***. Mongodb是一种面向文档的 ...
- mysql 5.6 General error: 1364 Field mysql 严格模式导致
问题:SQLSTATE[HY000]: General error: 1364 Field 解决方法:set global sql-mode=”NO_AUTO_CREATE_USER,NO_ENGIN ...
- log4net:ERROR XmlHierarchyConfigurator: Cannot find Property [File] to set object on [TF.Log.FileAppender]
难受,香菇. 大概研究了两个多小时,搜了很多资料都没有很完美的答案,最后突然脑子就一闪一闪,才弄明白咋回事. log4net:ERROR XmlHierarchyConfigurator: Canno ...
- 使用asp.net MVC的 HtmlHelper 时遇到的小问题,报错:Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.
异常信息:Templates can be used only with field access, property access, single-dimension array index, or ...
- Error reading field 'throttle_time_ms': java.nio.BufferUnderflowException
可能出现的问题: ERROR o.a.k.c.p.i.Sender – Uncaught error in kafka producer I/O thread: org.apache.kafka.co ...
- 我的Android进阶之旅------>解决Error:Could not find property 'compile' on org.gradle.api.internal.artifacts.
1错误描述 解决方法 1错误原因 2解决方法 1.错误描述 刚刚,Android Studio突然编译不了了,报了如下错误: Error:Could not find property 'compil ...
- legend2---数据字段没有默认值错误:SQLSTATE[HY000]: General error: 1364 Field 'h_21_injury_limit' doesn't have a default value
legend2---数据字段没有默认值错误:SQLSTATE[HY000]: General error: 1364 Field 'h_21_injury_limit' doesn't have a ...
- string(81) "SQLSTATE[HY000]: General error: 1364 Field 'content' doesn't have a default value"
mysql版本是5.7.26,在插入数据时报错: string(81) "SQLSTATE[HY000]: General error: 1364 Field 'content' doesn ...
随机推荐
- 数据挖掘之KNN算法(C#实现)
在十大经典数据挖掘算法中,KNN算法算得上是最为简单的一种.该算法是一种惰性学习法(lazy learner),与决策树.朴素贝叶斯这些急切学习法(eager learner)有所区别.惰性学习法仅仅 ...
- 《前端们,贺老 Live 面试你了!》所引发的思考与实践
贺老在知乎live中提到了一个这样的问题: 产品经理提出了一个需求:用户点击文章阅读,返回之后阅读其他文章.当用户看得多了,容易点到自己看过的文章,造成时间浪费.所以想给点击过的文章加一个标记,如:& ...
- C++11实现生产者消费者问题
生产者消费者问题是多线程并发中一个非常经典的问题.我在这里实现了一个基于C++11的,单生产者单消费者的版本,供大家参考. #include <windows.h> #include &l ...
- Axure 使用心得总结
Axure的本意是高效快捷的完成原型制作,能够清晰的说明功能,交互就是好的,"够漂亮"就行,不需要做到很完美,至于完美还是交给专业的UI吧. 一些心得记录下来: 1.下载一些常用的 ...
- EA使用
类逻辑图 关系1:泛化(继承),Driver和Northeastermer继承了Person类 关系2:实现,Northeastermer实现了LivingLeiFeng类 关系3: 关联,两个对象 ...
- oracleclient连oracle库 报System.Data.OracleClient 需要 Oracle 客户端软件 8.1.7 或更高版本
在iis下发布eworkflow+eform+ebiao的代码,访问oracle的数据库,用oracleClient或者oledb的方式连接,有时会报“System.Data.OracleClient ...
- python IDLE编程时遇到Python Error: Inconsistent indentation detected! 解决方法
仔细检查了几遍代码,发现indent没有错误! 之后试将所有indent都用空格代替,程序就跑起来了. 具体原因可能是IDLE环境内的Tab键有小bug.
- xampp下创建多个虚拟网站目录
大家知道,伟大的IIS下面增加多个网站就1分钟搞定.现在换XAMPP下运行多个PHP目录,那我们需要有点探索精神.那么进入正题 首先,下载安装官方最新版本的xampp,地址:点击.记得如果电脑安装有I ...
- Flex数据交互之Remoting
一 前言 Flex数据交互常用的有三种方式:WebService.HttpService以及Remoting. WebService方式已在这篇文章中给出,这篇文章主要讲解以Remoting方式进行数 ...
- 删除项目中的.svn信息
有时候我们新开发一个项目时,会将以前的项目从svn上down下来,然后复制一份.这样就会有个问题,项目中的svn信息就会一直存在.下面介绍删除方法: 1.新建一个.txt的文档.然后将下面代码粘贴到文 ...