public UIWebPage GetUIWebPage(long?lngWebPageId, string strWebPagePath) { UIWebPage objWebPage = new UIWebPage(); List <UIControl> lstControls = new List <UIControl>(); ProcedureName = "pr_GetUIWebPage"; using (DbCommand dbCommand = Database.GetStoredProcCommand(ProcedureName)) { Database.AddInParameter(dbCommand, "@WebPageId", DbType.Int64, lngWebPageId); Database.AddInParameter(dbCommand, "@WebPagePath", DbType.String, strWebPagePath); using (DataSet ds = ExecuteDataSet(dbCommand)) { if (ds.Tables[0].Rows.Count != 0) { DataRow drWebPage = ds.Tables[0].Rows[0]; objWebPage.WebPageId = long.Parse(drWebPage["WebPageId"].ToString()); objWebPage.Path = drWebPage["Path"].ToString(); objWebPage.Title = (drWebPage["Title"] != DBNull.Value ? drWebPage["Title"].ToString() : ""); objWebPage.HTMLHelp = (drWebPage["HelpHtml"] != DBNull.Value ? drWebPage["HelpHtml"].ToString() : ""); objWebPage.DisplayOrder = (drWebPage["DisplayOrder"] != DBNull.Value ? long.Parse(drWebPage["DisplayOrder"].ToString()) : 0); objWebPage.Enabled = (drWebPage["Enabled"] != DBNull.Value ? Int32.Parse(drWebPage["Enabled"].ToString()) : 0); objWebPage.Created = (drWebPage["Created"] != DBNull.Value ? DateTime.Parse(drWebPage["Created"].ToString()) : DateTime.Now); objWebPage.CreatedBy = (drWebPage["CreatedBy"] != DBNull.Value ? long.Parse(drWebPage["CreatedBy"].ToString()) : 0); objWebPage.Modified = (drWebPage["Modified"] != DBNull.Value ? DateTime.Parse(drWebPage["Modified"].ToString()) : DateTime.Now); objWebPage.ModifiedBy = (drWebPage["ModifiedBy"] != DBNull.Value ? long.Parse(drWebPage["ModifiedBy"].ToString()) : 0); objWebPage.Deleted = (drWebPage["Deleted"] != DBNull.Value ? Int32.Parse(drWebPage["Deleted"].ToString()) : 0); } } } objWebPage.ControlList = GetUIControls(objWebPage.WebPageId, 0); return(objWebPage); }
private void LoadUIControlList() { try { List <UIControl> oUIControlList = new List <UIControl>(); if (ddlSourceType.SelectedValue.ToString() == "1") //Web Page { UIWebPage oUIWebPage = oUIFactory.GetUIWebPage(ddlSourceFile.SelectedItem.Text.ToString()); oUIControlList = oUIWebPage.ControlList; } else if (ddlSourceType.SelectedValue.ToString() == "2") //User Control { UIWebUserControl oUIWebUserControl = oUIFactory.GetUIWebUserControl(ddlSourceFile.SelectedItem.Text.ToString()); oUIControlList = oUIWebUserControl.ControlList; } dlUIControls.DataSource = oUIControlList; dlUIControls.DataBind(); if (oUIControlList == null || oUIControlList.Count == 0) { pnlNoResults.Visible = true; pnlResults.Visible = false; } else { pnlNoResults.Visible = false; pnlResults.Visible = true; } } catch { } }
public static void LoadToolTipHelpValidations(ref System.Web.UI.Page oPage) { if (oPage != null) { UIFactory oUIFactory = new UIFactory(); UIWebPage oUIWebPage = oUIFactory.GetUIWebPage(oPage.AppRelativeVirtualPath.Substring(1)); ContentPlaceHolder oPlaceHolder = (ContentPlaceHolder)oPage.Master.FindControl("AllContent"); if (oPlaceHolder != null) { foreach (UIControl oUIControl in oUIWebPage.ControlList) { //Find the Label Control to Add Tooltip and Help Control oLabelControl = null; oLabelControl = oPlaceHolder.FindControl(oUIControl.LabelName); if (oLabelControl != null) { Label lbl = (Label)oLabelControl; //lbl.ToolTip = oUIControl.ToolTipText; //Check if already added the help if (lbl.Text.Contains("ShowHelpWindow") == false) { string strHelpPopup = ""; if (oUIControl.HTMLHelp != "") { strHelpPopup = " <a href=\"javascript:void(0);\" onclick=\"ShowHelpWindow('" + oUIControl.ControlId + "');\"><img src=\"/images/help_control.gif\" border=\"0\" align=\"absmiddle\"/></a>"; } lbl.Text = lbl.Text + strHelpPopup; //lbl.Text = oUIControl.LabelText+ strHelpPopup; } } //Find the Primary Control to add validations if (oUIControl.ControlName != "") { Control oPrimaryControl = oPlaceHolder.FindControl(oUIControl.ControlName); if (oPrimaryControl != null) { ApplyToolTip(ref oPrimaryControl, oUIControl); if (ConfigurationManager.AppSettings["CONTROLS_ADD_VALIDATIONS_FROM_DB"].ToString() == "1") { ApplyValidations(ref oPrimaryControl, ref oPlaceHolder, oUIControl); } } } } } //Loop through Page controls to check for User controls foreach (Control oControl in oPage.Controls) { Control oTmp = new Control(); oTmp = oControl; FindUserControlRecurrsive(ref oTmp); } } }