Exemplo n.º 1
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
		protected void Page_Load(object sender, EventArgs e)
		{
            AdminView view = ManagementContext.Current.FindView(this.AppId, this.ViewId);

            // Check view permissions
            if (view.Attributes.Contains("permissions"))
            {
                if (!ProfileContext.Current.CheckPermission(view.Attributes["permissions"].ToString()))
                    throw new UnauthorizedAccessException("Current user does not have enough rights to access the requested operation.");
            }

			Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "InitializeEcfListViewConstants",
				String.Format("CSManagementClient.EcfListView_PrimaryKeySeparator = '{0}';", EcfListView.ExtenderPrimaryKeyAttributeSeparator), true);

			HtmlTable tbl = this.FindControl("topTable") as HtmlTable;
			if (tbl != null)
			{
				if (this.ShowTopToolbar)
				{
					tbl.Visible = true;

					// bind MetaToolbar
					MetaToolbar1.ViewName = this.AppId;
					MetaToolbar1.PlaceName = this.ViewId;
					MetaToolbar1.GridClientId = GetListViewClientID();
					MetaToolbar1.DataBind();
				}
				else
				{
					DockTop.DefaultSize = 0;
					DockTop.Visible = false;
					tbl.Visible = false;
				}
				//tbl.Style["display"] = "none";
			}

			if (InnerListViewTable != null)
                gvHeaderExtender.TargetControlID = InnerListViewTable.UniqueID;

			gvHeaderExtender.ContextKey = UtilHelper.JsonSerialize(new EcfListViewContextKey(this.AppId, this.ViewId));
			gvHeaderExtender.ServicePath = ResolveUrl("~/Apps/Core/Controls/WebServices/EcfListViewExtenderService.asmx");

			DropDownList pagingList = MainListView.FindControl(EcfListView.DefaultPagingDropdownId) as DropDownList;
			if (pagingList != null)
				pagingList.SelectedIndexChanged += new EventHandler(ddPaging_SelectedIndexChanged);

			if (!IsPostBack && CurrentPager != null)
			{
				CurrentPager.SetPageProperties(0, CurrentListView.CurrentPageSize, true);
			}
		}