用.net写的网站出现在了问题, 不清楚怎么修改, 请大侠帮帮忙啊??/急啊 是 NewGrid 而不是 DataGrid1 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 说明很清楚了。。你的程序里面没有DataGrid1这个控件。。看看是不是命名出错了。 如一楼所说。你的程序里面只有NewGrid 这样一个GIRD控件。。代码是不是考过来的?没更新名称。太粗心 你DataGrid的ID是NewGrid。 楼上已经说得很清楚啦! 你自己没把当前使用datagrid控件的ID写正确! 没有错啊, DataGrid的ID是NewGrid 这里的没有错误啊 DataGrid的ID是NewGrid没错。。但是你数据绑定的时候用的ID是什么??不是这个吧。用了一个没有定义的ID,当然出错。。 DataGrid1.DataSource = ds.Tables["sale_net"].DefaultView; this.DataGrid1.DataBind();这里的DataGrid1换为NewGrid!!!!!!!!!!!! <asp:DataGrid ID="NewGrid" runat="server" AllowPaging="True" AutoGenerateColumns="False" BorderWidth="0px" CellPadding="0" GridLines="None" Height="1px" OnPageIndexChanged="DataGrid1_Page" PagerStyle-HorizontalAlign="Right" PageSize="10" ShowHeader="False" Width="237px">这边你给DataGrid的命名是 NewGrid后来的 DataGrid1.DataSource = ds.Tables["sale_net"].DefaultView; this.DataGrid1.DataBind(); 当然就找不以喽 <asp:DataGrid ID="NewGrid" 就是你把CS中的所有DataGrid1都改为NewGrid ID="NewGrid" ---------这是你写的。并没有DataGrid1,你的代码是抄的吧?注意ID相同。 你后台写的dataGrid的名字是NewGrid,而不是DataGrid1改一下名字就行了。呵呵。 <asp:DataGrid ID="NewGrid" DataGrid1.DataSource 应该一致 这还不清楚怎么修改,当然用 Visual Studio 2008 修改呗,2008带有自动搜寻并修复错误的智能化功能,项目设计只要用电子光笔画图就可以感应理解代码化,微软将在下一个版本2010中加入脑电图感应理解功能。 <asp:DataGrid ID="NewGrid" runat="server" AllowPaging="True" AutoGenerateColumns="False" BorderWidth="0px" CellPadding="0" GridLines="None" Height="1px" OnPageIndexChanged="DataGrid1_Page" PagerStyle-HorizontalAlign="Right" PageSize="10" ShowHeader="False" Width="237px"> 这边你给DataGrid的命名是 NewGrid 后来的 DataGrid1.DataSource = ds.Tables["sale_net"].DefaultView; this.DataGrid1.DataBind(); 当然就找不以喽 this.NewGrid.DataSource=ds.Tables["sale_net"].DefaultView; this.NewGrid.DataSource=ds.Tables["sale_net"].DefaultView; 正确答案。 id 名字都不同该成 NewGrid 就可以了 <asp:DataGrid ID="NewGrid" runat="server" AllowPaging="True" AutoGenerateColumns="False" BorderWidth="0px" CellPadding="0" GridLines="None" Height="1px" OnPageIndexChanged="DataGrid1_Page" PagerStyle-HorizontalAlign="Right" PageSize="10" ShowHeader="False" Width="237px"> 这边你给DataGrid的命名是 NewGrid 后来的 DataGrid1.DataSource = ds.Tables["sale_net"].DefaultView; this.DataGrid1.DataBind(); 你用this.不能出DataGrid1吧以后得细心点,this找的是DataGrid的ID再根据ID拿到整个DataGrid对象 方法一:将全部 NewGrid 改为 DataGrid1方法二:将全部 DataGrid1 改为 NewGrid DataGrid名错了,把后台的DataGrid1改成NewGrid就可以了,应该是 NewGrid 而不是 DataGrid1 前台HTML里的DataGrid的ID和你后台CS文件里的DataGrid的ID不一致,当然会出现错误了。希望楼主打好ASP.NET的基础。 这个网站技术是怎么实现的? (分享)NET 视频教程源码资料下载 csdn上下载的Web实例附加数据库为只读的,网页也不能运行,怎么办? 关于hyperlink控件 为什么不能设置断点 请问这个语句是什么意思? 请教Coalesys的PanelBar如何注册? RUL过长,下载文件保存时文件名称变短问题? 请教一个asp.net在iis上运行的问题 请问高手。?如何给自定义控件加事件? ASP.NET 里面如何引入公用的js和css? ASP.NET2.0中根据IP来获取客户端的地理位置
这里的没有错误啊
但是你数据绑定的时候用的ID是什么??不是这个吧。用了一个没有定义的ID,当然出错。。
this.DataGrid1.DataBind();这里的DataGrid1换为NewGrid!!!!!!!!!!!!
DataGrid1.DataSource = ds.Tables["sale_net"].DefaultView;
this.DataGrid1.DataBind(); 当然就找不以喽
---------
这是你写的。并没有DataGrid1,你的代码是抄的吧?注意ID相同。
DataGrid1.DataSource = ds.Tables["sale_net"].DefaultView;
this.DataGrid1.DataBind(); 当然就找不以喽
正确答案。
DataGrid1.DataSource = ds.Tables["sale_net"].DefaultView;
this.DataGrid1.DataBind();
你用this.不能出DataGrid1吧
以后得细心点,this找的是DataGrid的ID
再根据ID拿到整个DataGrid对象
方法二:将全部 DataGrid1 改为 NewGrid