Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将ListControl与DataTable绑定的常用方法_C# - Fatal编程技术网

C# 将ListControl与DataTable绑定的常用方法

C# 将ListControl与DataTable绑定的常用方法,c#,C#,嗨,今天的问候。。 我想编写一个通用方法,用DataTable将数据绑定到任何ListControl,并编写了以下代码。但当我将代码放在app_code文件夹中的类中以便在所有页面中访问时,我无法执行 请让我知道优化的编码方式,以及在app_code类或BAL(类库)中编写此类方法的位置 在VS 2010中,每当创建应用程序代码文件夹时,都会发生以下更改: 1. myClass will have the namespace as "myNamespace.App_Code" 2. myClas

嗨,今天的问候。。 我想编写一个通用方法,用DataTable将数据绑定到任何ListControl,并编写了以下代码。但当我将代码放在app_code文件夹中的类中以便在所有页面中访问时,我无法执行

请让我知道优化的编码方式,以及在app_code类或BAL(类库)中编写此类方法的位置


在VS 2010中,每当创建应用程序代码文件夹时,都会发生以下更改:

1. myClass will have the namespace as "myNamespace.App_Code"
2. myClass properties --> Build Action --> Content (which will disable intellisense)
不知道为什么会这样,但我过去常常通过做以下事情来解决这些问题:

1. Renaming "myNamespace.App_Code" to "myNamespace"
2. myClass properties --> Build Action --> Compile
除此之外,

尝试将方法的访问说明符设置为
public
,以访问常用代码。(假设您没有这样做)

1. Renaming "myNamespace.App_Code" to "myNamespace"
2. myClass properties --> Build Action --> Compile