这个错误在调试过程中没有任何提示的,一直到PageLoad的最后一句都没有错误。
后台代码- using System;
- using System.Collections;
- using System.Configuration;
- using System.Data;
- using System.Web;
- using System.Web.Security;
- using ExtAspNet;
- public partial class sysman_images_AuthorityManager : System.Web.UI.Page
- {
- public string role;
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- role = Request.QueryString["roleid"].ToString().Trim();
- CreateAccordion();
- btnClose.OnClientClick = ActiveWindow.GetConfirmHidePostBackReference();
- }
- }
-
- protected void CreateAccordion()
- {
- DataTable table = GetTable();
- DataRow[] rows = table.Select("PARENT_ID is null");
- foreach (DataRow row in rows)
- {
- //if (row.IsNull("PARENT_ID"))
- //{
- AccordionPane accordionPane = new AccordionPane();
- accordionPane.Title = row["menuname"].ToString();
- accordionPane.Layout = Layout.Fit;
- accordionPane.ShowBorder = false;
- accordionPane.BodyPadding = "2px 0 0 0";
- this.Accordion1.Items.Add(accordionPane);
- ResolveSubRow(table,row,accordionPane);
- //}
- }
- }
- protected void ResolveSubRow(DataTable table,DataRow row,AccordionPane pan)
- {
- string strAuth = GetAuth();
- string parentID = row["menu_id"].ToString();
- DataRow[] rows = table.Select("parent_id='" + parentID + "'");
- CheckBoxList chl = new CheckBoxList();
- chl.Label = row["menuname"].ToString();
- chl.ColumnNumber = 3;
- pan.Items.Add(chl);
- foreach (DataRow subRow in rows)
- {
- if (!subRow.IsNull("linkpage"))
- {
- string text = subRow["menuname"].ToString();
- string value = subRow["menu_id"].ToString();
- chl.Items.Add(text,value);
- }
- else
- {
- string parentID1 = subRow["menu_id"].ToString();
- DataRow[] rows1 = table.Select("parent_id='" + parentID1 + "'");
- foreach (DataRow subRow1 in rows1)
- {
- string text = subRow1["menuname"].ToString();
- string value = subRow1["menu_id"].ToString();
- chl.Items.Add(text, value);
- }
- }
- }
- chl.SelectedValueArray = strAuth.Split(',');
- }
- protected DataTable GetTable()
- {
- string strSql = "select menu_id,menuname,parent_id,linkpage from T_MENULIST order by parent_id";
- DataTable table = OracleHelper.ExcuteDataTableQuery(CommandType.Text, strSql);
- return table;
- }
- protected string GetAuth()
- {
- string strSql = "select menu_ids from T_AUTHORITY where role_id='" + role + "'";
- object result = OracleHelper.ExecuteScalar(strSql);
- if (null == result)
- return "";
- else
- return result.ToString();
- }
- #region Events
- protected void btnSaveRefresh_Click(object sender, EventArgs e)
- {
- System.Text.StringBuilder strAuth = new System.Text.StringBuilder("");
- foreach (CheckBoxList list in this.form1.Controls)
- {
- foreach (string item in list.SelectedValueArray)
- {
- if (strAuth.Length != 0)
- strAuth.Append(",");
- else
- strAuth.Append(item);
- }
- }
- string strSql = "update T_AUTHORITY set menu_ids='" + strAuth + "' where role_id='" + role + "'";
- try
- {
- int result = OracleHelper.ExecuteNonQuery(strSql);
- PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
- }
- catch (Exception ex)
- {
- Alert.Show("修改权限失败!");
- }
- }
-
- #endregion
- }
复制代码
|