protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { List <string> actionList = null; string sessionNameAction = ""; if (CurrentEnvironment.LoggedUser != null) { sessionNameAction = "__GIS_actionList_" + CurrentEnvironment.LoggedUser.Id; actionList = (List <string>)Session[sessionNameAction]; } if ((actionList != null) && actionList.Contains("ViewCommunity") && (CurrentEnvironment.LoggedUser != null)) { int userId = CurrentEnvironment.LoggedUser.Id; string language = CurrentEnvironment.Language; int languageId = int.Parse(language); Dictionary <string, string> wtList = (Dictionary <string, string>)HttpContext.Current.Cache["Community-dictionary" + language]; if (wtList == null) { List <WordTranslate> wordTranslateList = WordTranslate.GetWordByLanguage(languageId, "Community"); wtList = new Dictionary <string, string>(); foreach (WordTranslate vwt in wordTranslateList) { wtList.Add(vwt.Code, vwt.Name); } HttpContext.Current.Cache.Insert("Community-dictionary" + language, wtList); } //controls this.lblName.Text = wtList["CommunityName"]; this.lblIsActive.Text = wtList["CommunityIsActive"]; this.lblNotes.Text = wtList["CommunityNotes"]; //grid header text gvCommunity.Columns[1].HeaderText = wtList["CommunityName"]; gvCommunity.Columns[3].HeaderText = wtList["CommunityIsActive"]; gvCommunity.Columns[2].HeaderText = wtList["CommunityNotes"]; //actions this.btnAdd.Visible = actionList.Contains("AddCommunity"); this.btnEdit.Visible = actionList.Contains("EditCommunity"); this.btnRemove.Visible = actionList.Contains("RemoveCommunity"); //buttons this.btnAdd.Text = wtList["CommunityAddButton"]; this.btnEdit.Text = wtList["CommunityEditButton"]; this.btnRemove.Text = wtList["CommunityRemoveButton"]; //message this.lblSuccess.Text = wtList["CommunitySuccessText"]; this.lblWarning.Text = wtList["CommunityWarningText"]; this.lblError.Text = wtList["CommunityErrorText"]; //Page Title this.lblTitle.Text = wtList["CommunityPageTitle"]; //validators rfvName.ErrorMessage = wtList["CommunityMandatory"]; revName.ErrorMessage = wtList["CommunityNotValid"]; //selected object int id = -1; string _id = Request.QueryString["id"]; if (!String.IsNullOrEmpty(_id)) { int.TryParse(_id, out id); GIIS.DataLayer.Community o = GIIS.DataLayer.Community.GetCommunityById(id); txtName.Text = o.Name; txtNotes.Text = o.Notes; rblIsActive.Items[0].Selected = o.IsActive; rblIsActive.Items[1].Selected = !o.IsActive; gridview_Databind(id); btnAdd.Visible = false; } else { btnEdit.Visible = false; btnRemove.Visible = false; } } else { Response.Redirect("Default.aspx"); } } }