将数据绑定到GridView Asp.net [英] Bind Data to GridView Asp.net

查看:76
本文介绍了将数据绑定到GridView Asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我如何从代码中将数据绑定到asp.net GridView,我的意思是动态地而不是从数据库中,而不是从任何数据表或数据集中.仅仅来自代码...


我尝试这样做,但这没用

Hi can someone tell me how to bind data to a asp.net GridView from the code I mean dynamically not from the database, i mean not from any data table or data set. just purely from the code...


I tried doing this but this didn''t work

historyGridView.Rows[3].Cells[3].Text="ss";



我有一个例外的说法:
索引超出范围.必须为非负数并且小于集合的大小.参数名称:index



I got a exception saying :
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

推荐答案

http://msdn.microsoft.com/en-us/library/aa479339.aspx [ http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx [ ^ ]

http://www.c -sharpcorner.com/uploadfile/john_charles/data-binding-in-Asp-Net-2-0-using-gridview-control/ [
http://msdn.microsoft.com/en-us/library/aa479339.aspx[^]

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx[^]

http://www.c-sharpcorner.com/uploadfile/john_charles/data-binding-in-Asp-Net-2-0-using-gridview-control/[^]

Hope this helps.


此错误可能是由于以下原因引起的
1.不正确的行或列索引.
在此列中添加行,然后添加一些内容
this error might be comming for following reason
1. not proper row or column index.
add row in this column then add some stuff


这篇关于将数据绑定到GridView Asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆