devexpress怎样获取aspxpivotgrid里面被勾选的值
1个回答
2016-08-12 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
展示编辑按钮列编辑视图下控件的外观设置»DevExpress开发资源与帮助文档或者示例一:绑定到IList并实现删除和修改//展示publicvoidShowArticleImages(){intarticleId=Convert.ToInt32(Request.QueryString["articleId"]);IListimages=BlogArticleImage.ListArticleImages(articleId);this.gvImages.KeyFieldName="ImageId";this.gvImages.DataSource=images;this.gvImages.DataBind();}//更新protectedvoidgvImages_RowUpdating(objectsender,DevExpress.Web.Data.ASPxDataUpdatingEventArgse){intid=Convert.ToInt32(e.Keys[0]);stringdescript=Convert.ToString(e.NewValues["Description"]);stringkeywords=Convert.ToString(e.NewValues["Keywords"]);BlogArticleImageimage=BlogArticleImage.Retrieve(id);if(image!=null){image.Description=descript;image.Keywords=keywords;image.Persist();}e.Cancel=true;gvImages.CancelEdit();ShowArticleImages();}//删除protectedvoidgvImages_RowDeleting(objectsender,DevExpress.Web.Data.ASPxDataDeletingEventArgse){intid=Convert.ToInt32(e.Keys[0]);BlogArticleImageimage=BlogArticleImage.Retrieve(id);if(image!=null){System.IO.File.Delete(Server.MapPath(image.ImageUrl));System.IO.File.Delete(Server.MapPath(image.ThumbnailUrl));image.Remove();}e.Cancel=true;gvImages.CancelEdit();ShowArticleImages();}示例二:控件访问权限控制及CRUD操作//普通状态下的命令按钮显隐protectedvoidgv_HtmlRowCreated(objectsender,ASPxGridViewTableRowEventArgse){if(!gv.IsEditing&&e.RowType==DevExpress.Web.ASPxGridView.GridViewRowType.Data){boolisAdmin=Common.IsInRoles(newstring[]{WZWF.DAL.Roles.Admin});stringunit=gv.GetRowValues(e.VisibleIndex,"UNIT").ToString();boolisAuth=Common.IsInRoles(unit,WZWF.DAL.Roles.EnterpriseDepartment,WZWF.DAL.Roles.MaintainDepartment);//修改按钮WebControlbtnModify=e.Row.Cells[0].Controls[0]asWebControl;btnModify.Visible=isAuth;//新建按钮WebControlbtnAddNew=e.Row.Cells[0].Controls[1]asWebControl;btnAddNew.Visible=isAdmin;//删除按钮WebControlbtnDelete=e.Row.Cells[0].Controls[2]asWebControl;btnDelete.Visible=isAdmin;}}//编辑状态下的控件访问权限控制//管理员:unit,result,md_cmt,ed_cmt//政企部:ed_cmt//网络维护部:result,md_cmtprotectedvoidgrid_CellEditorInitialize(objectsender,ASPxGridViewEditorEventArgse){if(gv.IsEditing){//受理单位下拉框if(e.Column.FieldName=="UNIT"){ASPxComboBoxcombo=e.EditorasASPxComboBox;using(DbCleandb=newDbClean()){combo.DataSource=db.ListUnits();combo.TextField="ROLE";combo.ValueField="ROLE";combo.DataBind();}}//新建状态除了id以外都可以编辑if(gv.IsNewRowEditing){e.Editor.ReadOnly=(e.Column.FieldName=="ID");}//修改状态下根据角色可编辑部分数据else{e.Editor.ReadOnly=true;if(e.Column.FieldName=="UNIT")e.Editor.ReadOnly=!Common.IsInRoles(WZWF.DAL.Roles.Admin);elseif(e.Column.FieldName=="RESULT"||e.Column.FieldName=="MD_CMT")e.Editor.ReadOnly=!Common.IsInRoles(WZWF.DAL.Roles.Admin,WZWF.DAL.Roles.MaintainDepartment);elseif(e.Column.FieldName=="ED_CMT")e.Editor.ReadOnly=!Common.IsInRoles(WZWF.DAL.Roles.Admin,WZWF.DAL.Roles.EnterpriseDepartment);}}//可编辑控件设置背景色e.Editor.BackColor=e.Editor.ReadOnly?Color.White:Color.LightYellow;}//删除protectedvoidgv_RowDeleting(objectsender,ASPxDataDeletingEventArgse){intid=Convert.ToInt32(e.Keys[0]);using(DbCleandb=newDbClean())db.DelBasicNet(id);e.Cancel=true;gv.CancelEdit();ShowData(ViewState["Unit"].ToString());}//更新protectedvoidgv_RowUpdating(objectsender,ASPxDataUpdatingEventArgse){stringunit=Convert.ToString(e.NewValues["UNIT"]);stringresult=Convert.ToString(e.NewValues["RESULT"]);stringedCmt=Convert.ToString(e.NewValues["ED_CMT"]);if(gv.IsEditing){intid=Convert.ToInt32(e.Keys[0]);using(DbCleandb=newDbClean())db.ModBasicNet(id,);}e.Cancel=true;gv.CancelEdit();ShowData(ViewState["Unit"].ToString());}//新增protectedvoidgrid_InitNewRow(objectsender,ASPxDataInitNewRowEventArgse){e.NewValues["CREATOR"]=Page.User.Identity.Name;e.NewValues["CREATE_DT"]=System.DateTime.Now;}protectedvoidgv_RowInserting(objectsender,ASPxDataInsertingEventArgse){stringunit=Convert.ToString(e.NewValues["UNIT"]);stringresult=Convert.ToString(e.NewValues["RESULT"]);stringedCmt=Convert.ToString(e.NewValues["ED_CMT"]);if(gv.IsNewRowEditing){using(DbCleandb=newDbClean())db.AddBasicNet(..);}e.Cancel=true;gv.CancelEdit();ShowData(ViewState["Unit"].ToString());}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询