protected void btnSave_OnClick(object sender, CommandEventArgs e) { if (e.CommandName == "Save") { if (this.dlProviderList.Items.Count > 0) { List <Triplet <int, int, int> > itemList = new List <Triplet <int, int, int> >(); foreach (DataListItem lst in dlProviderList.Items) { if ((lst.ItemType == ListItemType.Item) || (lst.ItemType == ListItemType.AlternatingItem)) { int providerId = (int)dlProviderList.DataKeys[lst.ItemIndex]; CheckBox cbVisible = (CheckBox)lst.FindControl("cbVisible"); GroupRadioButton rbButton = (GroupRadioButton)lst.FindControl("rbAlign"); int active = (cbVisible.Checked) ? 1 : 0; int defaultVal = (rbButton.Checked) ? 1 : 0; itemList.Add(new Triplet <int, int, int>(providerId, active, defaultVal)); } } PaymentProviderManger.SaveProvider(itemList); } lblSuccess.Visible = true; lblCancel.Visible = false; } //redirect // Response.Redirect("Main.aspx"); }
/// <summary> /// "Select" button click event handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void selectButton_Click(object sender, System.EventArgs e) { // for each grid items... foreach (DataGridItem dgItem in countriesGrid.Items) { // get GroupRadioButton object... GroupRadioButton selectRadioButton = dgItem.FindControl("selectRadioButton") as GroupRadioButton; // if it is checked (current item is selected)... if (selectRadioButton != null && selectRadioButton.Checked) { DataTable dataSource = DataSource.CreateSampleDataSource(); // get country corresponding to the current item... DataRow row = dataSource.Rows.Find(countriesGrid.DataKeys[dgItem.ItemIndex]); // ...and show selected country information selectedCountryInfo.Text = String.Format("Selected country: {0}, Capital: {1}", row["Country"], row["Capital"]); return; } } // there are no selected countries selectedCountryInfo.Text = String.Empty; }
protected void dlProviderList_ItemDataBound(object sender, DataListItemEventArgs e) { PaymentProviderSetting Item = e.Item.DataItem as PaymentProviderSetting; if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { GroupRadioButton rbButton = (GroupRadioButton)e.Item.FindControl("rbAlign"); rbButton.Checked = Item.IsDefault; } }
private string getSelectedGatewayProduct() { foreach (RepeaterItem ri in repGateways.Items) { GroupRadioButton grb = ri.FindControl("rbGateway") as GroupRadioButton; HiddenField hfGatewayProductIdentifier = ri.FindControl("hfGatewayProductIdentifier") as HiddenField; if (grb.Checked) { return(hfGatewayProductIdentifier.Value); } } return(null); }
private string GetPaymentMethodSelected() { foreach (RepeaterItem item in rptPaymentMethods.Items) { GroupRadioButton rbutton = ecUtils.FindControl <GroupRadioButton>(item, "rbChecked"); // if (rbutton.Checked) { return((string)rbutton.ControlValue); } } // return(String.Empty); }
private string SyncDataListSelectionStr() { string planName = String.Empty; foreach (RepeaterItem item in rptHostingPlans.Items) { GroupRadioButton r_button = ecUtils.FindControl <GroupRadioButton>(item, "rbSelected"); if (r_button.Checked) { planName = r_button.Text; break; } } return(planName); }
private int SyncDataListSelection() { int selectedId = -1; foreach (RepeaterItem item in rptHostingPlans.Items) { GroupRadioButton r_button = ecUtils.FindControl <GroupRadioButton>(item, "rbSelected"); if (r_button.Checked) { selectedId = (int)r_button.ControlValue; break; } } return(selectedId); }
private int SyncSelectedCycle() { if (!AddonInfo.Recurring) { return(-1); } foreach (RepeaterItem item in rptAddonCycles.Items) { GroupRadioButton r_button = ecUtils.FindControl <GroupRadioButton>(item, "rbSelected"); // if (r_button != null && r_button.Checked) { return((int)r_button.ControlValue); } } return(-1); }
private void SavePages(Repeater e) { PageController pageController = new PageController(); foreach (RepeaterItem item in e.Items) { Label redirectId = (Label)item.FindControl("IdLabel"); PageModel pageModel = pageController.LoadPage(System.Convert.ToInt64(redirectId.Text)); pageModel.SaveStartPage = true; GroupRadioButton startPageCheckBox = (GroupRadioButton)item.FindControl("StartPageRadioButton"); pageModel.StartPage = startPageCheckBox.Checked; pageController.SavePage(pageModel); } }
protected void dlVersionList_ItemCommand(object sender, DataListCommandEventArgs e) { int versionId = (int)dlVersionList.DataKeys[e.Item.ItemIndex]; switch (e.CommandName) { case "Delete": CSFactory.RemoveVersion(versionId); BindVersion(); break; case "Edit": dlVersionList.EditItemIndex = e.Item.ItemIndex; BindVersion(); break; case "Cancel": dlVersionList.EditItemIndex = -1; BindVersion(); break; case "Update": TextBox txtEditTitle = (TextBox)e.Item.FindControl("txtEditTitle"); TextBox txtEditShortName = (TextBox)e.Item.FindControl("txtEditShortName"); CheckBox cbVisible = (CheckBox)e.Item.FindControl("cbVisible"); CheckBox cbDynamic = (CheckBox)e.Item.FindControl("cbDynamic"); DropDownList ddlCategory = (DropDownList)e.Item.FindControl("ddlEditCategory"); DropDownList ddlModel = (DropDownList)e.Item.FindControl("ddlModelEdit"); GroupRadioButton rbDesktop = (GroupRadioButton)e.Item.FindControl("rbDesktop"); GroupRadioButton rbTablet = (GroupRadioButton)e.Item.FindControl("rbTablet"); GroupRadioButton rbMobile = (GroupRadioButton)e.Item.FindControl("rbMobile"); CSFactory.UpdateVersion(versionId, CommonHelper.fixquotesAccents(txtEditTitle.Text.Trim()), CommonHelper.fixquotesAccents(txtEditShortName.Text), cbVisible.Checked, Convert.ToInt32(ddlCategory.SelectedValue) , cbDynamic.Checked, Convert.ToInt32(ddlModel.SelectedValue), rbDesktop.Checked, rbTablet.Checked, rbMobile.Checked); VersionManager.LoadVersions(); dlVersionList.EditItemIndex = -1; BindVersion(); break; } }
protected void dlVersionList_ItemDataBound(object sender, DataListItemEventArgs e) { CSBusiness.Version versionItem = e.Item.DataItem as CSBusiness.Version; if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { HyperLink hlTitle = e.Item.FindControl("hlTitle") as HyperLink; ITextControl lblStatus = e.Item.FindControl("lblStatus") as ITextControl; ITextControl lblShortName = e.Item.FindControl("lblShortName") as ITextControl; ITextControl lblCategoy = e.Item.FindControl("lblCategoy") as ITextControl; ITextControl lbModelVersion = e.Item.FindControl("lbModelVersion") as ITextControl; Label imgIsDynamic = e.Item.FindControl("imgIsDynamic") as Label; GroupRadioButton rbDesktop = (GroupRadioButton)e.Item.FindControl("rbDesktop"); GroupRadioButton rbTablet = (GroupRadioButton)e.Item.FindControl("rbTablet"); GroupRadioButton rbMobile = (GroupRadioButton)e.Item.FindControl("rbMobile"); LinkButton lbRemove = e.Item.FindControl("lbRemove") as LinkButton; if (!versionItem.IsDynamic) { imgIsDynamic.Visible = false; } hlTitle.Text = versionItem.Title; hlTitle.NavigateUrl = string.Format("~/{0}/", versionItem.Title); lblShortName.Text = versionItem.ShortName; lbModelVersion.Text = versionItem.ModelVersion; lblCategoy.Text = versionItem.CategoryTitle; lblStatus.Text = versionItem.Visible ? "Active" : "Inactive"; rbDesktop.Checked = versionItem.IsDesktopDefault; rbTablet.Checked = versionItem.IsTabletDefault; rbMobile.Checked = versionItem.IsMobileDefault; //Make sure admin mistakenly remove category if (versionItem.ShortName.ToLower() == "control") { lbRemove.Visible = false; } if (versionItem.HideRemove) { lbRemove.Visible = false; } } if (e.Item.ItemType == ListItemType.EditItem) { //Bind Categories DropDownList ddlEditCategory = (DropDownList)e.Item.FindControl("ddlEditCategory"); ddlEditCategory.DataSource = CSFactory.GetAllVersionCateogry(); ddlEditCategory.DataTextField = "Title"; ddlEditCategory.DataValueField = "CategoryId"; ddlEditCategory.DataBind(); ddlEditCategory.Items.Insert(0, new ListItem("Select", "")); GroupRadioButton rbDesktop = (GroupRadioButton)e.Item.FindControl("rbDesktop"); GroupRadioButton rbTablet = (GroupRadioButton)e.Item.FindControl("rbTablet"); GroupRadioButton rbMobile = (GroupRadioButton)e.Item.FindControl("rbMobile"); rbDesktop.Checked = versionItem.IsDesktopDefault; rbTablet.Checked = versionItem.IsTabletDefault; rbMobile.Checked = versionItem.IsMobileDefault; if (versionItem.CategoryId > 0) { ddlEditCategory.Items.FindByValue(versionItem.CategoryId.ToString()).Selected = true; } BindModelVersions(versionItem.Title, e.Item); if (versionItem.ModelVersionId > 0) { ListItem selectedItem = ddlModel.Items.FindByValue(versionItem.ModelVersionId.ToString()); if (selectedItem != null) { selectedItem.Selected = true; } } } }