-1

I'm a beginner at ASP.net. I want to create a custom GridView where it contains images and such.

But i've searched a lot for a guide that explains how to customize GridView controller. All existing ones (the ones i found of course) only talks about how to do a certain uses out of it, like e-commerce site Gridview, or inline Gridview and others. But none are explaining it for a beginner like me.

If there's a guide or even a good book for using and customizing ASP.net controls, i'd be grateful if you mentioned it.

4

2 回答 2

1

关于自定义 gridview 控件的一个非常好的教程是..

下面的链接也是gridview的另一个很好的教程系列,您还可以学习如何在gridview中保存图像或其他数据。

于 2013-01-09T05:58:30.223 回答
1

问题 1 - 好的 ASP.NET 书籍

真正帮助我学习 ASP.NET 的书是 - 70-515 Web Application Development With Microsoft .NET Framework 4

本书的唯一前提是 C# 或 VB.NET 以及一些基本的 HTML 知识,假设读者以前从未接触过 ASP.NET,所有示例都非常容易上手。每章的末尾都有步骤步骤实验室可指导您根据您在该章中学到的内容创建示例网站。

以下是本书涵盖的一些主题:

  1. ASP.NET 页面生命周期
  2. ASP.NET 服务器控件
  3. 数据绑定控件(GridView、DetailsView、ObjectDataSource、SqlDataSource)
  4. 验证和站点导航
  5. ASP.NET 中的数据访问
  6. 本地化与全球化
  7. AJAX 和 javascript (jQuery)
  8. ASMX Web 服务和 WCF
  9. ASP.NET 动态数据和 MVC
  10. 部署和监视 ASP.NET 应用程序

如果这听起来像你会感兴趣的东西,我是从亚马逊买的,但我知道 oreilly 也有库存

问题 2 - 从 GridView 开始

如果您想学习使用gridview,我建议您从基础开始,例如绑定到List<T>

ASPX:

<asp:GridView ID="gvEmployees" runat="server" AutoGenerateColumns="false">
    <Columns>
        <asp:BoundField DataField="Id" HeaderText="Id" />
        <asp:BoundField DataField="Name" HeaderText="Employee name" />
    </Columns>
</asp:GridView>

后面的代码:

public partial class WebForm1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            gvEmployees.DataSource = new List<Employee>()
            {
            new Employee{ Id=1,Name="Employee 1"},
            new Employee{ Id=2,Name="Employee 2"}
            };

            gvEmployees.DataBind();
        }
    }
}

public class Employee
{
    public int Id { get; set; }
    public string Name { get; set; }
}

一旦你掌握了基础知识,只需使用 gridview 并尝试绑定到不同类型的对象,你就会很快掌握它:

  1. 将 gridview 绑定到 SQL 表
  2. 将gridview绑定到图像列表
于 2013-01-09T05:47:05.163 回答