我想问一个关于如何使用C#在ASP.net编码中进行分页的问题.
我尝试做的是,我想显示一些内容,有多列和多行.
在实际编码中,我有一个对象列表,比如说对象A.
class A {
integer id;
string name;
string desc;
}
Run Code Online (Sandbox Code Playgroud)
并希望将其显示在具有可分页功能的页面上.
我做谷歌搜索,ASP.net提供gridview和listview,但它们都需要一个数据源,这意味着该表直接绑定到数据库.
这不是我想要的,因为我的对象A列表来自其他地方,而不是来自我的数据库(例如,它是一个复合数据集,在运行时生成)
所以它仍然在那里我仍然可以使用那些有益的组件,或者我必须自己做所有的分页???
谢谢
对于我目前的应用程序,我从西班牙的不同"活动提供商"收集图像.
Bitmap bmp=null;
HttpGet httpRequest = new HttpGet(strURL);
long t = System.currentTimeMillis();
HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
Log.i(TAG, "Image ["+ strURL + "] fetched in [" + (System.currentTimeMillis()-t) + "ms]");
HttpEntity entity = response.getEntity();
InputStream instream = entity.getContent();
bmp = BitmapFactory.decodeStream(instream);
return bmp;
Run Code Online (Sandbox Code Playgroud)
但是,从salir.com下载图像时,我得到以下logcat输出:
13970 Gallery_Activity I Fetching image 2/8 URL: http://media.salir.com/_images_/verticales/a/0/1/0/2540-los_inmortales_la_trattoria-marc_aureli_27_29_no.jpg
13970 ServiceHttpRequest I Image [http://media.salir.com/_images_/verticales/a/0/1/0/2540-los_inmortales_la_trattoria-marc_aureli_27_29_no.jpg] fetched in [146ms]
13970 skia D --- decoder->decode returned false
Run Code Online (Sandbox Code Playgroud)
搜索该错误消息没有提供太多有用的结果.
谁知道问题可能是什么?
格拉西亚斯!
更新1:
在查询了更多并测试不同的东西后,我发现问题似乎在于其他地方.即使我的logcat输出说
13970 ServiceHttpRequest I Image [http://media.salir.com/_images_/verticales/a/0/1/0/2540-los_inmortales_la_trattoria-marc_aureli_27_29_no.jpg] fetched in [146ms] …Run Code Online (Sandbox Code Playgroud) C#:我有一组对象.T有2个属性.属性A和属性B.此集合需要遵守的规则是A和B的值组合在集合中必须是唯一的.换句话说,A和B需要用作复合主键.
在Linq有一个操作我可以用来检查这种情况吗?我希望它会像
if (items.Select(x => x.Name).Distinct().Count() != items.Select(x => x.Name).Count())
Run Code Online (Sandbox Code Playgroud)
上面的陈述是我如何检查集合中是否有重复名称的项目,但我不知道如何为多个属性执行此操作.
我正在使用WCF REST stater工具包来构建一个简单的xml over HTTP服务.作为这个Im的一部分,我使用RequestInterceptor进行身份验证.在RequestInterceptor内部,我可以访问System.ServiceModel.Channels.RequestContext对象,从中可以获取请求url,querystring params和其他有用的东西.我无法解决的是如何访问请求的HttpContext.我有几个东西存储在HttpContext中,我想在requestInterceptor中访问但是我很难找到它们.当我在Visual Studio中使用quickwatch时,我可以看到它隐藏在requestContext的私有成员中.有人可以告诉我如何访问HttpContext,也许使用RequestContext对象上的反射?
我有一个SQL服务器存储过程,它接受日期作为输入参数在其中构建一个查询.所以我应该在定义存储过程时使用哪个数据类型参数.表示使用nvarchar(15)和datetime之间的区别.
1 : create procedure TestProcedure(@startDate datetime)
and
2 : create procedure TestProcedure(@startDate nvarchar(15))
Run Code Online (Sandbox Code Playgroud)
是否有任何优势是我在性能方面使用datetime over varchar
我注意到很多网站不再需要解决方法,因此关闭cookie的用户仍然可以在网站上获得相同的体验.这个问题在现代网络开发中消失了吗?我们已经达到了没有人这样做的地步,所以我们不需要打扰吗?
我想知道对for循环中的最后一个元素进行特殊处理的最佳方法(更紧凑和"pythonic"方式).有一段代码只能在元素之间调用,在最后一个元素中被抑制.
以下是我目前的工作方式:
for i, data in enumerate(data_list):
code_that_is_done_for_every_element
if i != len(data_list) - 1:
code_that_is_done_between_elements
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法?
注意:我不想使用hacks,例如使用reduce;)
我正在尝试在两个SQL Server 2008表之间移动一些数据.如果Table2中的记录与Table1中的电子邮件一起存在,则使用Table1中的数据更新该记录,否则插入新记录.
在表1中,我有许多列; 名字,姓氏,电子邮件等.
如果Table1中的电子邮件存在,我不太确定如何构造查询来更新Table2,如果表2中不存在Table1的电子邮件,我不会插入新行.
我尝试在Google上进行一些搜索,但大多数解决方案似乎都是通过创建一些存储过程来实现的.所以我想知道是否有人可能知道如何构建一个可能做到这一点的合适查询?
java ×3
c# ×2
sql ×2
android ×1
asp.net ×1
bugfender ×1
cookies ×1
fencepost ×1
for-loop ×1
httpclient ×1
httpcontext ×1
idioms ×1
immutability ×1
linq ×1
merge ×1
pagination ×1
python ×1
sql-server ×1
upsert ×1
wcf ×1
wcf-rest ×1
xml ×1
xsd ×1