⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usermanager.aspx.cs

📁 java 最出色的报表工具代码,愿分享....
💻 CS
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
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.Xml.Linq;
using Infragistics.WebUI.UltraWebGrid;

public partial class Admin_Frameset_BasicMrg_UserManager : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string str = "add";
            this.lkAdd.Attributes.Add("onclick", "popup('" + str + "')");
            if (!IsPostBack)
            {
                this.lkModify.Enabled = false;
               this.lkDel.Enabled = false;
            }
            bind();

            Users user = new Users();
            this.UltraWebGrid1.DataSource = user.getDs();
            this.UltraWebGrid1.DataBind();
            this.UltraWebGrid1.Columns[0].Header.Caption = "自动编号";
            this.UltraWebGrid1.Columns[1].Header.Caption = "登录ID";
            this.UltraWebGrid1.Columns[2].Header.Caption = "用户名";
            this.UltraWebGrid1.Columns[3].Header.Caption = "Email";
            UltraWebGrid1.DisplayLayout.SelectTypeRowDefault = SelectType.Single;
            UltraWebGrid1.DisplayLayout.SelectedRows.Add(UltraWebGrid1.Rows[0]);
            UltraWebGrid1.DisplayLayout.SelectTypeColDefault = SelectType.Single;
            UltraWebGrid1.DisplayLayout.AllowUpdateDefault = AllowUpdate.Yes;
            UltraWebGrid1.DisplayLayout.AllowColSizingDefault = AllowSizing.Free;
            UltraWebGrid1.DisplayLayout.TableLayout = TableLayout.Fixed;
        }
    }
    public void bind()
    {
        Users user = new Users();
        this.UltraWebGrid1.DataSource = user.getDs();
        this.UltraWebGrid1.DataBind();
    }
    protected void lkDel_Click(object sender, EventArgs e)
    {
        if (this.UltraWebGrid1.DisplayLayout.SelectedRows.Count > 0)
        {
            Users user = new Users();
            Boolean flag = user.delUsers(Convert.ToInt32(this.UltraWebGrid1.DisplayLayout.SelectedRows[0].Cells[0].Value.ToString()));
            if (flag)
            {

                Response.Write("<script>alert('删除成功!')</script>");
                bind();
            }
            else
            {
                Response.Write("<script>alert('出现异常错误!')</script>");
            }
        }
    }
    protected void lkAdd_Click(object sender, EventArgs e)
    {
        string str = "add";
        this.lkAdd.Attributes.Add("onclick", "popup('" + str + "')");
        bind();
    }
    protected void lkModify_Click(object sender, EventArgs e)
    {
        if(this.UltraWebGrid1.DisplayLayout.SelectedRows.Count > 0)
        this.lkModify.Attributes.Add("onclick", "popup('" + this.UltraWebGrid1.DisplayLayout.SelectedRows[0].Cells[0].Value.ToString() + "')");
        bind();
    }
    protected void UltraWebGrid1_Click(object sender, ClickEventArgs e)
    {
        this.lkModify.Enabled = true;
        this.lkDel.Enabled = true;
        if (this.UltraWebGrid1.DisplayLayout.SelectedRows.Count > 0)
        this.lkModify.Attributes.Add("onclick", "popup('" + this.UltraWebGrid1.DisplayLayout.SelectedRows[0].Cells[0].Value.ToString() + "')");
    }
    protected void UltraWebGrid1_DblClick(object sender, ClickEventArgs e)
    {

    }
    protected void UltraWebGrid1_InitializeLayout(object sender, LayoutEventArgs e)
    {
        e.Layout.Pager.AllowPaging = true;
        e.Layout.Pager.PageSize = 1;
    }
    protected void UltraWebGrid1_PageIndexChanged(object sender, Infragistics.WebUI.UltraWebGrid.PageEventArgs e)
    {
        this.UltraWebGrid1.DisplayLayout.Pager.CurrentPageIndex = e.NewPageIndex;
        bind();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -