ASP.net Gridview 使用指南
GridView使用详解
01 GridView无代码分页排序
02 GridView选中,编辑,取消,删除
03 GridView正反双向排序
04 GridView和下拉菜单DropDownList结合
05 GridView和CheckBox结合
06 鼠标移到GridView某一行时改变该行的背景色方法一
07 鼠标移到GridView某一行时改变该行的背景色方法二
08 GridView实现删除时弹出确认对话框
09 GridView实现自动编号
10 GridView实现自定义时间货币等字符串格式
11 GridView实现用“...”代替超长字符串
12 GridView一般换行与强制换行
13 GridView显示隐藏某一列
14 GridView弹出新页面/弹出新窗口
15 GridView固定表头(不用javascript只用CSS,2行代码,很好用)
16 GridView合并表头多重表头无错完美版(以合并3列3行举例)
17 GridView突出显示某一单元格(例如金额低于多少,分数不及格等)
18 GridView加入自动求和求平均值小计
19 GridView数据导入Excel/Excel数据读入GridView 1.GridView简单代码分页排序: 1.AllowSorting设为True,aspx代码中是AllowSorting="True"; 2.默认1页10条,如果要修改每页条数,修改PageSize即可,在aspx代码中是PageSize="12"。 3.默认的是单向排序的,右击GridView弹出“属性”,选择AllowSorting为True即可。 4.添加代码: protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; Bind(); } 2.GridView选中,编辑,取消,删除: 后台代码: using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; public partial class _Default : System.Web.UI.Page { SqlConnection sqlcon; SqlCommand sqlcom; string strCon = "Data Source=(local);Database=数据库名;Uid=帐号;Pwd=密码"; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bind(); } } protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { GridView1.EditIndex = e.NewEditIndex; bind(); } //删除 protected void GridView1_RowDeleting(object sender,
相关文档:
今天纠结了一上午的问题,于下午3点12分尘埃落定!
事情是这样的:
作为一个里程碑记录下吧,也算是我第一次将asp.net与数据库结合,并完成从软件编程到web的过渡。
在此感谢今天为我解决问题的“杀手”(也称老道),还有以前为我解决问题的大队、御风、华哥等牛...
言归正传,本文介绍一下怎样在asp. ......
在使用asp.net编写webservice时,默认情况下是不支持session的,但我们可以把WebMethod的EnableSession选项设为true来显式的打开它,请看以下例子:
1 新建网站WebSite
2 新建web服务WebService.asmx,它具有以下两个方法:
[WebMethod(EnableSession = true)]
public string Login(string name)
{
  ......
更新方法一,直接在GridView中来更新数据.
更新方法二,打开一个新的页面来更新数据.
//更新
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
&nbs ......
解决办法:app_code/ 存放一个类 用来截获HTTP
1.代码如下
using System;
using System.IO;
using System.Web;
using System.Text;
using System.Text.RegularExpressions;
/// <summary>
/// Removes whitespace from the webpage.
/// </summary>
public class ViewstateModule : IHttpModule
{
......