当前位置: 首页>>代码示例>>C#>>正文


C# String.StartsWithCSafe方法代码示例

本文整理汇总了C#中String.StartsWithCSafe方法的典型用法代码示例。如果您正苦于以下问题:C# String.StartsWithCSafe方法的具体用法?C# String.StartsWithCSafe怎么用?C# String.StartsWithCSafe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在String的用法示例。


在下文中一共展示了String.StartsWithCSafe方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsConnectionStringValid

 /// <summary>
 /// Test if connection string is to be shown in selector
 /// </summary>
 /// <param name="conn">Connection string text</param>
 protected bool IsConnectionStringValid(String conn)
 {
     return !conn.StartsWithCSafe("ldap", true);
 }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:8,代码来源:SelectConnectionString.ascx.cs

示例2: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        objectType = UIContextHelper.GetObjectType(UIContext);
        CloneItemButton.Visible = DisplayCloneButton;

        // Pass tabindex
        int tabIndex = ValidationHelper.GetInteger(UIContext["TabIndex"], 0);
        if (tabIndex != 0)
        {
            tabIndexStr = "&tabindex=" + tabIndex;
        }

        String editElem = ValidationHelper.GetString(UIContext["itemEdit"], String.Empty);
        String categoryElem = ValidationHelper.GetString(UIContext["categoryedit"], String.Empty);
        categoryPathColumn = ValidationHelper.GetString(UIContext["pathColumn"], String.Empty);
        categoryParentColumn = ValidationHelper.GetString(UIContext["categoryparentcolumn"], String.Empty);
        categoryObjectType = ValidationHelper.GetString(UIContext["parentobjecttype"], String.Empty);
        itemParentColumn = ValidationHelper.GetString(UIContext["parentColumn"], String.Empty);
        newItem = ValidationHelper.GetString(UIContext["newitem"], String.Empty);

        if (!ValidateInput())
        {
            return;
        }

        itemLocation = URLHelper.AppendQuery(UIContextHelper.GetElementUrl(ResourceName, editElem), "?tabslayout=horizontal&displaytitle=false");
        categoryLocation = URLHelper.AppendQuery(UIContextHelper.GetElementUrl(ResourceName, categoryElem), "?tabslayout=horizontal&displaytitle=false");

        RegisterExportScript();
        RegisterTreeScript();
        InitTree();

        // Setup menu action scripts
        String newItemText = newItem.StartsWithCSafe("javascript", true) ? newItem : "NewItem('item'); return false;";

        AddButon.Actions.Add(new CMSButtonAction
        {
            Text = GetString(objectType + ".newitem"),
            OnClientClick = newItemText
        });
        AddButon.Actions.Add(new CMSButtonAction
        {
            Text = GetString("development.tree.newcategory"),
            OnClientClick = "NewItem('category'); return false;"
        });

        DeleteItemButton.OnClientClick = "DeleteItem(); return false;";
        ExportItemButton.OnClientClick = "ExportObject(); return false;";
        CloneItemButton.OnClientClick = "if ((selectedItemId > 0) && (selectedItemType == 'item')) { modalDialog('" + URLHelper.ResolveUrl("~/CMSModules/Objects/Dialogs/CloneObjectDialog.aspx?reloadall=1&displaytitle=" + UIContext["displaytitle"] + "&objecttype=" + objectType + "&objectid=") + "' + selectedItemId, 'Clone item', 750, 470); } return false;";

        // Tooltips
        DeleteItemButton.ToolTip = GetString("development.tree.deleteselected");
        ExportItemButton.ToolTip = GetString("exportobject.title");
        CloneItemButton.ToolTip = GetString(objectType + ".clone");

        // URLs for menu actions
        String script = "var doNotReloadContent = false;\n";

        // Script for deleting widget or category
        string delPostback = ControlsHelper.GetPostBackEventReference(this, "##");
        string deleteScript = "function DeleteItem() { \n" +
                              " if ((selectedItemId > 0) && (selectedItemParent > 0) && " +
                              " confirm(" + ScriptHelper.GetLocalizedString("general.deleteconfirmation") + ")) {\n " +
                              delPostback.Replace("'##'", "selectedItemType+';'+selectedItemId+';'+selectedItemParent") + ";\n" +
                              "}\n" +
                              "}\n";
        script += deleteScript;

        // Preselect tree item
        if (!RequestHelper.IsPostBack())
        {
            int parentobjectid = QueryHelper.GetInteger("parentobjectid", 0);
            int objectID = QueryHelper.GetInteger("objectID", 0);

            // Select category
            if (parentobjectid > 0)
            {
                BaseInfo biParent = BaseAbstractInfoProvider.GetInfoById(categoryObjectType, parentobjectid);
                if (biParent != null)
                {
                    String path = ValidationHelper.GetString(biParent.GetValue(categoryPathColumn), String.Empty);
                    int parentID = ValidationHelper.GetInteger(biParent.GetValue(categoryParentColumn), 0);
                    script += SelectAfterLoad(path, parentobjectid, "category", parentID, true, true);
                }
            }
            // Select item
            else if (objectID > 0)
            {
                BaseInfo bi = BaseAbstractInfoProvider.GetInfoById(objectType, objectID);
                if (bi != null)
                {
                    script += SelectItem(bi);
                }
            }
            else
            {
                // Selection by hierarchy URL
                BaseInfo biSel = UIContext.EditedObject as BaseInfo;
                BaseInfo biParent = UIContext.EditedObjectParent as BaseInfo;

//.........这里部分代码省略.........
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:101,代码来源:GeneralTree.ascx.cs


注:本文中的String.StartsWithCSafe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。