예제 #1
0
        protected void ActiveLanguage_SelectedIndexChanged(object sender, EventArgs e)
        {
            Language lang = LanguageDataSource.Load(AlwaysConvert.ToInt(ActiveLanguage.SelectedValue));

            if (lang != null)
            {
                LanguageDataSource.SetActiveLanguage(lang);
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _LanguageId = AlwaysConvert.ToInt(Request.QueryString["LanguageId"]);
            _Language   = LanguageDataSource.Load(_LanguageId);
            if (_Language == null)
            {
                Response.Redirect("Languages.aspx");
            }

            Caption.Text = string.Format(Caption.Text, _Language.Name);

            //ResourcesGrid.ShowFooter = false;
        }
        protected void UpdateLanguage()
        {
            if (Page.IsValid)
            {
                Language language = LanguageDataSource.Load(this.LanguageId);
                language.Name    = Name.Text.Trim();
                language.Culture = CultureList.SelectedValue;

                language.Save();
                SavedMessage.Text    = string.Format(SavedMessage.Text, language.Name);
                SavedMessage.Visible = true;
                if (ItemUpdated != null)
                {
                    ItemUpdated(this, new PersistentItemEventArgs(this.LanguageId, language.Name));
                }
            }
        }
예제 #4
0
        protected void LanguagesGrid_RowEditing(object sender, GridViewEditEventArgs e)
        {
            int      languageId = (int)LanguagesGrid.DataKeys[e.NewEditIndex].Value;
            Language language   = LanguageDataSource.Load(languageId);

            if (language != null)
            {
                AddPanel.Visible  = false;
                EditPanel.Visible = true;
                EditCaption.Text  = string.Format(EditCaption.Text, language.Name);
                EditLanguageDialog editDialog = EditPanel.FindControl("EditLanguageDialog1") as EditLanguageDialog;
                if (editDialog != null)
                {
                    editDialog.LanguageId = languageId;
                }
                AddEditAjax.Update();
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            Language language = LanguageDataSource.Load(this.LanguageId);

            if (language != null)
            {
                Name.Text = language.Name;
                CultureList.SelectedIndex = -1;

                ListItem item = CultureList.Items.FindByValue(language.Culture);
                if (item != null)
                {
                    item.Selected = true;
                }
            }
            else
            {
                this.Controls.Clear();
            }
        }