Exemple #1
0
        public static string GetUrl(string sInput, string sRelativeUrl)
        {
            string sOrg = sInput.Trim();

            if (sRelativeUrl.ToLower().StartsWith("http") || sRelativeUrl.ToLower().StartsWith("https"))
            {
                return(sRelativeUrl.Trim());
            }
            if (sRelativeUrl.StartsWith("/"))
            {
                return(GetDomain(sInput) + sRelativeUrl);
            }
            if (sRelativeUrl.StartsWith("../"))
            {
                while (sRelativeUrl.IndexOf("../") >= 0)
                {
                    sOrg         = CString.GetPreStrByLast(sOrg, "/");
                    sRelativeUrl = sRelativeUrl.Substring(3);
                }
                return(sOrg + "/" + sRelativeUrl.Trim());
            }
            if (sRelativeUrl.Trim() != "")
            {
                return(CString.GetPreStrByLast(sInput, "/") + "/" + sRelativeUrl);
            }
            sRelativeUrl = sInput;
            return("");
        }
Exemple #2
0
        public static string GetTitle(string sInput, string sRegex)
        {
            string str = CString.ClearTag(GetText(sInput, sRegex, "Title"));

            if (str.Length > 0x63)
            {
                str = str.Substring(0, 0x63);
            }
            return(str);
        }
Exemple #3
0
 public static void BindDropDownList(DataView dv, DropDownList ddl, string sValueField, string sTextField, string sPreText)
 {
     ddl.Items.Clear();
     if ((ddl != null) && (dv != null))
     {
         if (!CString.IsEmpty(sPreText))
         {
             ddl.Items.Add(new ListItem(sPreText, "0"));
         }
         foreach (DataRowView view in dv)
         {
             ddl.Items.Add(new ListItem(view[sTextField].ToString(), view[sValueField].ToString()));
         }
         if (ddl.Items.Count > 0)
         {
             ddl.SelectedIndex = 0;
         }
     }
 }