vs2005 GrdiView 的小问题 50分 速度拿去。。。

YSEE 2006-04-24 08:20:45
问题1:
无法显示Microsoft文档资源管理器,因为指定的帮助集合"ms-help://MS.MSDNQTR.v80.chs"无效
这就是错误呢,
请问这是什么原因呢,要怎么解决呢?,谢谢
重装也没用。
问题2:
<asp:GridView ID="GridView1" runat="server" Height="10px" Width="126px" AutoGenerateColumns="False">
<PagerTemplate>
<asp:Image ID="Image1" runat="server" Height="8px" Width="8px" ImageUrl="../../images/15x15.gif" />
<asp:Label ID="LB1" runat="server" Height="8px" Width="8px" Text='<%# Eval("name") %>'></asp:Label>
</PagerTemplate>
</asp:GridView>

protected void Page_Load(object sender, EventArgs e)
{
GridView1.DataSource = ysee.Product.GetCategoryList();
GridView1.DataBind();
}
ysee.Product.GetCategoryList()出的数据是
name
1
2
3

我那步错了?怎么帮定不了数据
在vs2003里都会用。MSDN2005又用不了。只有发贴了。
在vs2003里
private void DataGrid1_PageIndexChanged(object source,System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
DataGrid1.DataBind();
}
2005里不用了??怎么办呀。
...全文
159 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
antiking 2006-04-24
  • 打赏
  • 举报
回复
重装吧.还是一样问题的话你的安装软件有问题...
YSEE 2006-04-24
  • 打赏
  • 举报
回复
第2个问题是列的问题。哈哈。

可第一个问题是不是非要重装VS2005呢?
antiking 2006-04-24
  • 打赏
  • 举报
回复
DataKeys="你的字段"
YSEE 2006-04-24
  • 打赏
  • 举报
回复
protected void Page_Load(object sender, EventArgs e)
{
GridView1.DataSource = ysee.Product.GetCategoryList();
GridView1.DataBind();
}
当AutoGenerateColumns="True"时页面上显示
name
1
2
3
当AutoGenerateColumns="False"时页面上没有显示

页面是得到了数据,但帮定步凑有错。

和VS2003比。好想少了个索引的问题。但不知道怎么做
quou2002 2006-04-24
  • 打赏
  • 举报
回复
1、msdn版本可能不对;
2、你的GridView的AutoGenerateColumns="False",即非自动生成列,而你代码声明里没有声明列,当然什么都没有显示的。
例如下面的<Columns>....</Columns>就是在AutoGenerateColumns="False"的情况下显示声明的列。
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataKeyNames="DepartmentId" DataSourceID="SqlDataSource1" PageSize="3">
<Columns>
<asp:BoundField DataField="DepartmentId" HeaderText="DepartmentId" ReadOnly="True"
SortExpression="DepartmentId" />
<asp:BoundField DataField="DepartName" HeaderText="DepartName" SortExpression="DepartName" />
</Columns>
</asp:GridView>
因为你不是使用数据源控件自动绑定,可以设置自动生成列AutoGenerateColumns="True",试试看。

另外,我看见你欲自定义分页界面(设置 PagerTemplate 属性后,该属性重写内置页导航行用户界面。)通常,将按钮控件添加到页导航模板以执行分页操作。单击 CommandName 属性设置为“Page”的按钮控件时,GridView 控件会执行分页操作。按钮的 CommandArgument 属性确定要执行的分页操作的类型。下表列出了 GridView 控件支持的命令参数值。

“CommandArgument值”---“说明”
“Next”- 导航至下一页。
“Prev”- 导航至上一页。
“First”- 导航至第一页。
“Last”- 导航至最后一页。
整数值 - 导航至指定页码。

可能你不方便查msdn,贴段msdn中的示例:
下面的代码示例演示如何创建一个允许用户使用 DropDownList 控件在 GridView 控件中进行导航的自定义页导航模板。
<%@ Page language="C#" %>

<script runat="server">

void PageDropDownList_SelectedIndexChanged(Object sender, EventArgs e)
{

// Retrieve the pager row.
GridViewRow pagerRow = CustomersGridView.BottomPagerRow;

// Retrieve the PageDropDownList DropDownList from the bottom pager row.
DropDownList pageList = (DropDownList)pagerRow.Cells[0].FindControl("PageDropDownList");

// Set the PageIndex property to display that page selected by the user.
CustomersGridView.PageIndex = pageList.SelectedIndex;

}

void CustomersGridView_DataBound(Object sender, EventArgs e)
{

// Retrieve the pager row.
GridViewRow pagerRow = CustomersGridView.BottomPagerRow;

// Retrieve the DropDownList and Label controls from the row.
DropDownList pageList = (DropDownList)pagerRow.Cells[0].FindControl("PageDropDownList");
Label pageLabel = (Label)pagerRow.Cells[0].FindControl("CurrentPageLabel");

if(pageList != null)
{

// Create the values for the DropDownList control based on
// the total number of pages required to display the data
// source.
for(int i=0; i<CustomersGridView.PageCount; i++)
{

// Create a ListItem object to represent a page.
int pageNumber = i + 1;
ListItem item = new ListItem(pageNumber.ToString());

// If the ListItem object matches the currently selected
// page, flag the ListItem object as being selected. Because
// the DropDownList control is recreated each time the pager
// row gets created, this will persist the selected item in
// the DropDownList control.
if(i==CustomersGridView.PageIndex)
{
item.Selected = true;
}

// Add the ListItem object to the Items collection of the
// DropDownList.
pageList.Items.Add(item);

}

}

if(pageLabel != null)
{

// Calculate the current page number.
int currentPage = CustomersGridView.PageIndex + 1;

// Update the Label control with the current page information.
pageLabel.Text = "Page " + currentPage.ToString() +
" of " + CustomersGridView.PageCount.ToString();

}

}

</script>

<html>
<body>
<form runat="server">

<h3>GridView PagerTemplate Example</h3>

<asp:gridview id="CustomersGridView"
datasourceid="CustomersSqlDataSource"
autogeneratecolumns="true"
allowpaging="true"
ondatabound="CustomersGridView_DataBound"
runat="server">

<pagerstyle forecolor="Blue"
backcolor="LightBlue"/>

<pagertemplate>

<table width="100%">
<tr>
<td width="70%">

<asp:label id="MessageLabel"
forecolor="Blue"
text="Select a page:"
runat="server"/>
<asp:dropdownlist id="PageDropDownList"
autopostback="true"
onselectedindexchanged="PageDropDownList_SelectedIndexChanged"
runat="server"/>

</td>

<td width="70%" align="right">

<asp:label id="CurrentPageLabel"
forecolor="Blue"
runat="server"/>

</td>

</tr>
</table>

</pagertemplate>

</asp:gridview>

<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the Northwind sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<asp:sqldatasource id="CustomersSqlDataSource"
selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server">
</asp:sqldatasource>

</form>
</body>
</html>










==== 我的邮箱:quou2002@tom.com
~~~~ 我的Blog:http://blog.csdn.net/quou2002
xcz1943 2006-04-24
  • 打赏
  • 举报
回复
chagel(Mike in Shanghai)
在很多情况下,用那些datasource绑定是无法完成任务的。不相信你自己试试。
gridview使用一切正常。看看是不是你的连接出错。
YSEE 2006-04-24
  • 打赏
  • 举报
回复
返回一个DataSet
triffang 2006-04-24
  • 打赏
  • 举报
回复
反正我用的时候是没有什么问题
triffang 2006-04-24
  • 打赏
  • 举报
回复
ysee.Product.GetCategoryList()
不知道你这个方法是返回什么的?
一个DataSet?一个集合?
下面的是改成这个了
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{

}
chagel 2006-04-24
  • 打赏
  • 举报
回复
aspnet2不推荐直接绑定,参考
http://www.asp.net/QuickStart/aspnet/doc/ctrlref/data/gridview.aspx
第1章(\C01)
示例描述:本章讲解了如何使用C#开发第一个应用程序。
Web应用程序 用C#开发的第一个Web应用程序。
Windows应用程序 用C#开发的第一个Windows应用程序。

第3章(\C03)
示例描述:本章学习了面向对象编成的基本步骤。
StudentClassAPP 一个Windows应用程序的“学生”类。
OOPSample 使用OOP创建了一个面向对象的应用程序。

第4章(\C04)
示例描述:本章学习了C#中数组的使用。
ArrayListSample 动态数组的应用实例。
SortedListSample 可排序数组的应用实例。
第6章(\C06)
示例描述:本章介绍了如何跟踪应用程序。
TraceSample 一个跟踪应用程序的实例。

第8章(\C08)
示例描述:介绍文件管理类的使用。
ResourceManager 一个基于Windows窗体的资源管理器实例。

第9章(\C09)
示例描述:本章介绍了Windows 窗体中常用的控件。
AdRotatorSample 自动广告播放器实例。
CatalogZoneSample 目录部件的使用实例。
EditorZoneSample 可编辑部件的使用实例。
MultiViewSample 多视图控件的使用实例。
SiteMapPathSample 导航控件的使用实例。
SubstitutionSample Substitution控件的使用实例。
WebPartZoneSample WebPart部件的使用实例。
WizardSample 向导控件的使用实例。

第10章(\C10)
示例描述:本章示例展现了如何处理应用程序中的错误。
AppErrorSample 全局错误处理应用案例。
CodeErrorSample 代码错误处理案例。
PageErrorSample 页面级错误处理应用案例。
WebConfigErrorSample 使用配置文件处理全局错误应用案例。

第11章(\C11)
示例描述:本章介绍了如何部署Windows应用程序。
FirstWebInstall 第一个安装实例。
WebInstallSample 安装实例的源项目代码。

第12章(\C12)
示例描述:本章演示如何保障网站的安全。
allowSample 授权用户权限的实例。
CreateUserSample 创建用户的实例。
denySample 拒绝为用户授权的实例。
FindUserSample 使用Membership查询用户的实例。
FormsAuthSample 使用Forms进行身份验证的实例。
MembershipUserSample Membership类的应用实例。
ValidateUserSample 如何验证用户的案例。
WindowsAuthSample 使用Windows进行身份验证的实例。

第13章(\C13)
示例描述:本章演示了如何使用Web服务。
WebServiceSample 创建Web服务的实例。
WebServiceWeather 用Web服务获取天气预报的实例
WebServiceSession 在Web服务中应用Session的实例

第14章(\C14)
示例描述:本章介绍个性配置的基本概念及如何使用。
ProfileWebSite 使用Profile个性定义的实例。

第15章(\C15)
示例描述:本章介绍.NET 2.0提供的个性UI。
MasterPageSample 使用母版页的案例。
NestedMasterPage 母版页嵌套的应用案例。
ThemeSample 使用皮肤文件的应用案例。

第16章(\C16)
示例描述:本章介绍了页面状态的4种管理方法。
ApplicationSample Application状态应用案例。
CookieSample Cookie状态应用案例。
SessionSample Session状态应用案例。
ViewStateSample ViewState状态应用案例。

第17章(\C17)
示例描述:本章介绍了ADO.NET中的基本知识。
DataColumnSample DataTable中的列应用实例。
DataRowSample DataTable中的行应用实例。
DataTableSample DataTable应用实例。
SqlCommandEdit 使用SqlCommand实现更新的案例。
SqlCommandReader 使用SqlCommand实现读取的案例。
SqlCommandScalar 使用SqlCommand实现读取一个字段的案例。
SqlDataReaderSample 使用SqlCommand实现只进读取器的案例。

第18章(\C18)
示例描述:本章介绍了Windows应用程序中的数据控件。
BindingSourceArray 绑定数组数据源的案例。
BindingSourceDataSet 绑定DataSet数据源的案例。
DataGridViewEdit Windows中的数据显示控件实现编辑的案例。
DataGridViewRowCol 读取数据控件中的行和列的案例。
DataGridViewSample 数据视图使用案例。
DataGridViewWebService 数据视图与Web服务结合的使用案例。
EditDataSetSample 编辑数据源的案例。
ServiceData 提供Web服务数据的案例。

第19章(\C19)
示例描述:本章介绍了Web应用程序中的数据控件。
DataListEdit DataList控件的编辑案例。
DataListSample DataList控件的应用案例。
DetailsViewEdit 用DetailsView控件实现编辑的案例。
DetailsViewInsert 用DetailsView控件实现插入的案例。
DetailsViewSample DetailsView使用案例。
GridViewCheckBox 在GridView中使用复选框的案例。
GridViewEditDelete 用GridView实现编辑和删除的应用案例。
GridViewMultiEdit 用GrdiView实现多行编辑的案例。
GridViewPager GridView的翻页案例。
ObjectDataSourceFillCheckBox 使用ObjectDataSource数据源的案例。
ObjectDataSourceParameters 使用带参数的ObjectDataSource数据源的案例。
RepeaterSample 使用Repeater控件的实例。
SiteMapDataSourceSample 使用导航控件数据源的实例。
SqlDataSourceFillListBox 使用SQL数据源控件填充列表。
UserControlSample 创建用户控件的实例。
XmlDataSourceTreeView 使用XML数据源填充树。
XmlDataSourceXPath XmlDataSource数据源的过滤实例。

第20章(\C20)
示例描述:介绍ADO.NET和XML文件的转换。
DataSetTOXML 数据集转换为XML文件的实例。
XmlDataDocumentSample XML文件作为数据源的应用案例。
XmlDocumentSample XML文档对象模型的应用案例。
XmlNodeSample XML节点的使用案例。
XmlReaderSample XML读取器的应用案例。
XMLToDataSet 将XML文件转换为数据集的案例。
XmlWriterSample XML编写器的应用案例。

第21章(\C21)
示例描述:介绍如何使用缓存。
CacheDependency 缓存依赖实例
CacheXmlDependency 文件缓存依赖实例。
DataSetCache 数据集缓存的实例。
OutputCacheControl 片断缓存的应用案例。
OutputCacheParmSample 缓存参数的使用案例。
OutputCacheVarySample 缓存变量的使用案例
OutuutCacheSample 页面缓存应用案例。

第27章(\C27)
示例描述:通过一个课程管理系统学习了如何创建Web项目。
数据库备份 课程管理系统的数据库。
数据库脚本 课程管理系统的数据库脚本。
课程管理系统源代码 课程管理系统中所需要的页面和代码。

62,242

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧