温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:社会标签(Tags)文章管理系统源码
当前文件:
TagsArticle/Admin/RoleManage.aspx.cs,打开代码结构图
TagsArticle/Admin/RoleManage.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using Web2ASPNET2.WebTags; 12
using Web2ASPNET2.CommonOperation; 13
using Web2ASPNET2.UserCommonOperation; 14
15
public partial class Admin_RoleManage:System.Web.UI.Page 16
{ 17
protected void Page_Load(object sender,EventArgs e) 18
{ ///判断用户是否登录 19
UserInfo info = (UserInfo)UserCommonOperation.GetUserInfo(Session); 20
if(info == null) 21
{ ///返回到上一个页面 22
Response.Write("<script>history.back()</script>"); 23
///跳转到登录页面 24
Server.Transfer("~/Portal/UserLogin.aspx"); 25
return; 26
} 27
///绑定控件的数据 28
if(!Page.IsPostBack) 29
{ 30
BindPageData(); 31
} 32
} 33
private void BindPageData() 34
{ ///绑定控件的数据 35
Role role = new Role(); 36
Web2ASPNET2.CommonOperation.DataBinder.BindGridViewData( 37
gvRole,role.GetRoles(WebTags.WebTagsProjectID)); 38
} 39
protected void btnAdd_Click(object sender,EventArgs e) 40
{ ///页面重定向 41
Server.Transfer("~/Admin/AddRole.aspx"); 42
} 43
protected void gvRole_RowCommand(object sender,GridViewCommandEventArgs e) 44
{ 45
if(e.CommandName == "update") 46
{ ///执行重定向操作 47
Server.Transfer("~/Admin/UpdateRole.aspx?RoleID=" + e.CommandArgument.ToString()); 48
} 49
if(e.CommandName == "del") 50
{ ///执行删除操作 51
Role role = new Role(); 52
role.DeleteRole(DataTypeConvert.ConvertToInt(e.CommandArgument.ToString())); 53
///重新绑定控件数据 54
BindPageData(); 55
} 56
} 57
protected void gvRole_RowDataBound(object sender,GridViewRowEventArgs e) 58
{ ///为删除按钮添加确认对话框 59
ImageButton ibtDelete = (ImageButton)e.Row.FindControl("ibtDelete"); 60
if(ibtDelete != null) 61
{ 62
ibtDelete.Attributes.Add("onclick","return confirm('你确定要删除所选择的数据行吗?');"); 63
} 64
} 65
} 66





}
}