Esempio n. 1
0
        private void DgContents_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var fieldInfo = (FieldInfo)e.Item.DataItem;
            var settings  = new FieldSettings(fieldInfo.Settings);

            var ltlTitle       = (Literal)e.Item.FindControl("ltlTitle");
            var ltlDescription = (Literal)e.Item.FindControl("ltlDescription");
            var ltlFieldType   = (Literal)e.Item.FindControl("ltlFieldType");
            var ltlValidate    = (Literal)e.Item.FindControl("ltlValidate");
            var ltlActions     = (Literal)e.Item.FindControl("ltlActions");

            ltlTitle.Text       = fieldInfo.Title;
            ltlDescription.Text = fieldInfo.Description;
            ltlFieldType.Text   = FieldTypeUtils.GetText(FieldTypeUtils.GetEnumType(fieldInfo.FieldType));

            ltlValidate.Text = ValidateTypeUtils.GetValidateInfo(settings.IsRequired,
                                                                 settings.MinNum, settings.MaxNum, settings.ValidateType);

            ltlActions.Text = $@"
<a class=""m-r-10"" href=""{PageFieldsUrl}&taxis={true}&direction=Up&fieldId={fieldInfo.Id}"">上升</a>
<a class=""m-r-10"" href=""{PageFieldsUrl}&taxis={true}&direction=Down&fieldId={fieldInfo.Id}"">下降</a>
<a class=""m-r-10"" href=""javascript:;"" onclick=""{ModalFieldAdd.GetOpenScript(SiteId, FormInfo.Id, fieldInfo.Id)}"">编辑</a>
<a class=""m-r-10"" href=""javascript:;"" onclick=""{ModalFieldValidate.GetOpenScript(SiteId, FormInfo.Id, fieldInfo.Id)}"">验证规则</a>
<a class=""m-r-10"" href=""{PageFieldsUrl}&delete={true}&fieldId={fieldInfo.Id}"">删除</a>";
        }
Esempio n. 2
0
        private void DgContents_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var fieldInfo = (FieldInfo)e.Item.DataItem;
            var settings  = new FieldSettings(fieldInfo.FieldSettings);

            var ltlAttributeName = (Literal)e.Item.FindControl("ltlAttributeName");
            var ltlDisplayName   = (Literal)e.Item.FindControl("ltlDisplayName");
            var ltlFieldType     = (Literal)e.Item.FindControl("ltlFieldType");
            var ltlIsDisabled    = (Literal)e.Item.FindControl("ltlIsDisabled");
            var ltlValidate      = (Literal)e.Item.FindControl("ltlValidate");
            var ltlActions       = (Literal)e.Item.FindControl("ltlActions");

            ltlAttributeName.Text = fieldInfo.AttributeName;

            ltlDisplayName.Text = fieldInfo.DisplayName;
            ltlFieldType.Text   = FieldTypeUtils.GetText(FieldTypeUtils.GetEnumType(fieldInfo.FieldType));

            ltlIsDisabled.Text = fieldInfo.IsDisabled
                ? @"<span class=""label label-danger"">已禁用</span>"
                : @"<span class=""label label-primary"">已启用</span>";
            ltlValidate.Text = ValidateTypeUtils.GetValidateInfo(settings.IsRequired,
                                                                 settings.MinNum, settings.MaxNum, settings.ValidateType);

            ltlActions.Text = $@"
<a class=""m-r-10"" href=""{PageUrl}&taxis={true}&direction=Up&fieldId={fieldInfo
                .Id}"">上升</a>
<a class=""m-r-10"" href=""{PageUrl}&taxis={true}&direction=Down&fieldId={fieldInfo
                .Id}"">下降</a>
<a class=""m-r-10"" href=""{PageUrl}&addField={true}&fieldId={fieldInfo.Id}"">编辑</a>
<a class=""m-r-10"" href=""{PageUrl}&validateField={true}&fieldId={fieldInfo.Id}"">验证规则</a>
<a class=""m-r-10"" href=""{PageUrl}&delete={true}&fieldId={fieldInfo.Id}"">删除</a>";
        }