作者:菲菲鱼2009 | 来源:互联网 | 2023-08-11 14:28
下拉框的使用:
设计风格: |
<select name="DesignStyle" class="select"> select> |
---|
单选按钮:
多选按钮:
2:
<tr>
<th>通知字段:th>
<td>
<div class="sys_agent_per">
<ul>
<li><label><input type="checkbox" name="NoticeField" value="OrderID" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "OrderID") ? "checked" : "")>订单号label>li>
<li><label><input type="checkbox" name="NoticeField" value="UserName" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "UserName") ? "checked" : "")>姓名label>li>
<li><label><input type="checkbox" name="NoticeField" value="Mobile" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "Mobile") ? "checked" : "")>手机号码label>li>
<li><label><input type="checkbox" name="NoticeField" value="CardID" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "CardID") ? "checked" : "")>身份证号码label>li>
<li><label><input type="checkbox" name="NoticeField" value="Address" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "Address") ? "checked" : "")>配送地址label>li>
<li><label><input type="checkbox" name="NoticeField" value="Email" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "Email") ? "checked" : "")>电子邮箱label>li>
<li><label><input type="checkbox" name="NoticeField" value="ProductName" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "ProductName") ? "checked" : "")>产品名称label>li>
<li><label><input type="checkbox" name="NoticeField" value="PlayTime" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "PlayTime") ? "checked" : "")>出行日期label>li>
<li><label><input type="checkbox" name="NoticeField" value="Number" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "Number") ? "checked" : "")>订单数量label>li>
<li><label><input type="checkbox" name="NoticeField" value="Memo" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "Memo") ? "checked" : "")>订单备注label>li>
<li><label><input type="checkbox" name="NoticeField" value="ConferPrice" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "ConferPrice") ? "checked" : "")>签约价label>li>
<li><label><input type="checkbox" name="NoticeField" value="TotalConferPrice" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "TotalConferPrice") ? "checked" : "")>签约价小计label>li>
<li><label><input type="checkbox" name="NoticeField" value="Price" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "Price") ? "checked" : "")>分销价label>li>
<li><label><input type="checkbox" name="NoticeField" value="TotalPrice" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "TotalPrice") ? "checked" : "")>分销价小计label>li>
<li><label><input type="checkbox" name="NoticeField" value="SalePrice" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "SalePrice") ? "checked" : "")>零售价label>li>
<li><label><input type="checkbox" name="NoticeField" value="TotalSalePrice" @(TravelB2B.Core.Utils.Tools.NoticeFieldChecked(Model.NoticeField, "TotalSalePrice") ? "checked" : "")>零售价小计label>li>
ul>
div>
td>
tr>
共用方法:
public static bool NoticeFieldChecked(string[] noticeField, string field)
{
return NoticeFieldChecked(Array2String(noticeField), field);
}
#region 数组转化成逗号隔开的字符串
///
/// 数组转化成逗号隔开的字符串
///
///
///
public static string Array2String(string[] arr)
{
return Array2String(arr, ",");
}
public static string Array2String(string[] arr, string splitChar)
{
if (arr != null)
{
StringBuilder sb = new StringBuilder();
if (arr != null)
{
for (int i = 0; i )
{
sb.Append(arr[i]);
if (i + 1 < arr.Length) sb.Append(splitChar);
}
}
return sb.ToString();
}
return string.Empty;
}
#endregion
public static bool NoticeFieldChecked(string noticeField, string field)
{
if (string.IsNullOrEmpty(noticeField))
{
noticeField = "OrderID,UserName,Mobile,ProductName,PlayTime,Number";
}
if (!noticeField.StartsWith(",")) noticeField = "," + noticeField;
if (!noticeField.EndsWith(",")) { noticeField += ","; }
return noticeField.IndexOf("," + field + ",") > -1;
}
MODEL: public String[] NoticeField { get; set; }
实体: public string NoticeField{get;set;}
Info.NoticeField = TravelB2B.Core.Utils.Tools.Array2String(this.NoticeField);
保存代码:
if (Info.NoticeField != TravelB2B.Core.Utils.Tools.Array2String(this.NoticeField))
{
sb.Append("NoticeField的值由" + Info.NoticeField + "改为" + this.NoticeField + "
");
Info.NoticeField = TravelB2B.Core.Utils.Tools.Array2String(this.NoticeField);
}
保存后数据库值为:OrderID,UserName,Mobile,ProductName,PlayTime,Number