ShowHideGridViewColumnsClient.aspx.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
public partial class ShowHideGridViewColumnsClient : System.Web.UI.Page
{
#region Properties & Fields
/// <summary>
/// List of column names
/// </summary>
List<string> columnNames = new List<string>() { "Id", "Description", "Assigned To", "Status" };
#endregion
#region Page Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
_sampleData = null;
// Populate the GridView
this.GridView1.DataSource = _sampleData;//51aspx
this.GridView1.DataBind();
// Setup the dropdown list to allow the user to show hidden columns
SetupShowHideColumns(this.GridView1, this.GridView1ShowHideColumns);
}
}
#endregion
#region GridView Events
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
GridView gridView = (GridView)sender;
StringBuilder sb = new StringBuilder();
// For the header row add a link to each header
// cell which can call the HideCol javascript method
if (e.Row.RowType == DataControlRowType.Header)
{
// Loop through each cell of the row
for (int columnIndex = 0; columnIndex < e.Row.Cells.Count; columnIndex++)
{
// Build the hide column link
sb.Remove(0, sb.Length); // first empty the StringBuilder
sb.Append("javascript:HideCol('");
后面还有 107 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
