HTML:
MR.Lee提供解决无法自动加载焦点方案:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomerVisitsAdd.aspx.cs" Inherits="DzPlatForm.CRM.AddCustomerVisits" ValidateRequest="false" %> <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %> 客户拜访记录<%----%>
后台:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Ext.Net; using System.Text; using DzPlatForm.Model; using DzPlatForm.BLL; namespace DzPlatForm.CRM { public partial class AddCustomerVisits : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["Id"] != null) { txtId.Text = Request.QueryString["Id"].ToString(); txtType.Text = "Edit"; FormPanel1.Title = "修改拜访记录"; DefaultValues(int.Parse(txtId.Text.Trim())); } else { txtType.Text = "Add"; FormPanel1.Title = "新增客户拜访记录"; } lblVisitor.Text = "屈文明"; lblVisitorCode.Text = "A328"; FormPanel1.SetValues(new { VisitDate = System.DateTime.Now.ToShortDateString() }); this.FieldSet3.Collapsed = true; } } ////// 默认值 //////private void DefaultValues(int id) { ListIList = new List(); CustomerVisitsBLL cvbll = new CustomerVisitsBLL(); IList = cvbll.IList(id); foreach (var i in IList) { //基本信息资料 this.cbxCompany.SetValue(i.Company.ToString()); dfVisitDate.SetValue(i.VisitorDate.ToString()); txtCustomerCode.SetValue(i.CustomerCode.ToString()); txtCusomerName.SetValue(i.CustomerName.ToString()); lblVisitorCode.Text = i.VisitorCode.ToString(); lblVisitor.Text = i.Visitor.ToString(); txtVistorPurpose.SetValue(i.VisitPurpose.ToString()); txtVisitCotent.InnerText = i.VisitContent.ToString(); txtMetWith.SetValue(i.MetWith.ToString()); txtActionItem.InnerText = i.ActionItem.ToString(); } } ////// 保存 /////////protected void SaveData(object sender, DirectEventArgs e) { if (this.dfVisitDate.Text.Trim() == "0001-1-1 0:00:00") { X.Msg.Notify("提示", "请选择访问日期"); return; } //var values = JSON.Deserialize关注打赏