public void RedirectIfNoReturnUrl(string url, string returnUrl, params string[] parameters) { string currentReturnUrl = SecureUrl.ReturnUrl; SecureUrl secureUrl; if (currentReturnUrl.Length > 0) { secureUrl = new SecureUrl(currentReturnUrl); } else { secureUrl = new SecureUrl(url); } if (!StringHelper.IsBlank(returnUrl)) { secureUrl.ReturnUrl = returnUrl; } if (parameters != null) { if ((parameters.Length % 2) == 0) { for (int i = 0; i < parameters.Length; i += 2) { secureUrl[parameters[i]] = parameters[i + 1]; } } } Redirect(secureUrl); }
public static SecureUrl BuildSecureUrl(string url, //string returnUrl,IFacade facade, // just to make the code error free string returnUrl, IHRMemberFacade facade, params string[] parameters) { SecureUrl secureUrl = new SecureUrl(url); if ((parameters != null) && (parameters.Length > 0)) { if ((parameters.Length % 2) == 0) { for (int i = 0; i < parameters.Length; i += 2) { secureUrl[parameters[i]] = parameters[i + 1]; } } } if (!StringHelper.IsBlank(returnUrl)) { secureUrl.ReturnUrl = returnUrl; } return(secureUrl); }
private static void IterateControlsToBuildUrl(ref SecureUrl url, Control control) { TextBox txt = control as TextBox; CheckBox chk = control as CheckBox; RadioButton rdo = control as RadioButton; ListControl lst = control as ListControl; if (txt != null) { if (!StringHelper.IsBlank(txt.Text)) { url[txt.UniqueID] = txt.Text; } } else if (chk != null) { url[chk.UniqueID] = StringHelper.Convert(chk.Checked); } else if (rdo != null) { url[rdo.UniqueID] = StringHelper.Convert(rdo.Checked); } else if (lst != null) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < lst.Items.Count; i++) { if (lst.Items[i].Selected) { sb.Append(lst.Items[i].Value); sb.Append("|"); } } if (sb.Length > 0) { sb.Remove(sb.Length - 1, 1); } if (sb.Length > 0) { url[lst.UniqueID] = sb.ToString(); } } else { if (control.Controls.Count > 0) { for (int i = 0; i < control.Controls.Count; i++) { IterateControlsToBuildUrl(ref url, control.Controls[i]); } } } }
public static void SetHyperLink(HyperLink link, string url, string returnUrl, string text, params string[] parameters) { SecureUrl secureUrl = UrlHelper.BuildSecureUrl(url, returnUrl, parameters); SetHyperLink(link, secureUrl, text); }
private void IterateControlsToLoadState(Control control) { TextBox txt = control as TextBox; CheckBox chk = control as CheckBox; RadioButton rdo = control as RadioButton; ListControl lst = control as ListControl; SecureUrl url = this.SecureUrl; if (url.Contains(control.UniqueID)) { if (txt != null) { txt.Text = url[txt.UniqueID]; } else if (chk != null) { chk.Checked = Convert.ToBoolean(url[chk.UniqueID], CultureInfo.CurrentCulture); } else if (rdo != null) { rdo.Checked = Convert.ToBoolean(url[rdo.UniqueID], CultureInfo.CurrentCulture); } else if (lst != null) { string[] selectedItems = url[lst.UniqueID].Split('|'); if ((selectedItems != null) && (selectedItems.Length > 0)) { for (int i = 0; i < selectedItems.Length; i++) { for (int j = 0; j < lst.Items.Count; j++) { if (StringHelper.IsEqual(selectedItems[i], lst.Items[j].Value)) { lst.Items[j].Selected = true; break; } } } } } } else { if (control.Controls.Count > 0) { for (int i = 0; i < control.Controls.Count; i++) { IterateControlsToLoadState(control.Controls[i]); } } } }
public static void PopulateControlStateIntoSecureUrl(SecureUrl url, ControlCollection controls) { if (controls.Count > 0) { for (int i = 0; i < controls.Count; i++) { IterateControlsToBuildUrl(ref url, controls[i]); } } }
public static void SetHyperLink(HyperLink link, string url, //string returnUrl, IFacade facade, // just to make it error free string returnUrl, IHRMemberFacade facade, string text, params string[] parameters) { SecureUrl secureUrl = UrlHelper.BuildSecureUrl(url, returnUrl, facade, parameters); SetHyperLink(link, secureUrl, text); }
public static SecureUrl BuildSecureUrlFromControlState(string url, string returnUrl, ControlCollection controls) { SecureUrl securlUrl = new SecureUrl(url); PopulateControlStateIntoSecureUrl(securlUrl, controls); if (!StringHelper.IsBlank(returnUrl)) { securlUrl.ReturnUrl = returnUrl; } return(securlUrl); }
public static SecureUrl BuildSecureUrl(string url, string returnUrl, params string[] parameters) { SecureUrl secureUrl = new SecureUrl(url); if ((parameters != null) && (parameters.Length > 0)) { if ((parameters.Length % 2) == 0) { for (int i = 0; i < parameters.Length; i += 2) { secureUrl[parameters[i]] = parameters[i + 1]; } } } if (!StringHelper.IsBlank(returnUrl)) { secureUrl.ReturnUrl = returnUrl; } return(secureUrl); }
public void Redirect(SecureUrl url) { Redirect(url.ToString()); }
public static void SetHyperLink(HyperLink link, SecureUrl url) { SetHyperLink(link, url.ToString()); }
public static void SetHyperLink(HyperLink link, SecureUrl url, string text) { SetHyperLink(link, url.ToString(), text); }