<dx:ASPxComboBox ID="comBrand" CssClass="case" ClientInstanceName="comBrand" runat="server" ValueType="System.String" ValueField="BrandID" TextField="BrandName" OnCallback="ComBrand_Callback">
<ClientSideEvents EndCallback="EndCallback_Brand" />
<ValidationSettings ErrorTextPosition="Bottom" Display="Dynamic">
<RequiredField ErrorText="品牌不能为空!" IsRequired="true" />
</ValidationSettings>
</dx:ASPxComboBox>
protected void ComBrand_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e)
{
string ClientID = e.Parameter;
List<string> sqlList = new List<string>
{
string.Format(SQL_DATABrand_SELECT, QHString.QuotedStr(ClientID)),
SQL_DATAClient_SELECT + " WHERE ClientID=" + QHString.QuotedStr(ClientID),//客户
string.Format(SQL_ClientContact_SELECT, QHString.QuotedStr(ClientID))//客户联系人
};
DataSet ds = ApiMethod.GetDataSetBySqllist(sqlList);
comBrand.DataSource = ds.Tables[0];
comBrand.DataBind();
//利用品牌结束回调绑定客户联系人信息
if (ds.Tables[2].Rows.Count > 0)
{
comBrand.JSProperties["cpContact"] = "{\"Name\":\"" + QHString.ToString(ds.Tables[2].Rows[0]["Name"]) + "\",\"Phone\":\"" + QHString.ToString(ds.Tables[2].Rows[0]["Phone"]) + "\",\"Mail\":\"" + QHString.ToString(ds.Tables[2].Rows[0]["Mail"]) + "\",\"Location\":\"" + QHString.ToString(ds.Tables[1].Rows[0]["Location"]) + "\"}";
}
else
{
comBrand.JSProperties["cpContact"] = "{\"Name\":\"\",\"Phone\":\"\",\"Mail\":\"\",\"Location\":\"\"}";
}
}
function EndCallback_Brand(result) {
var cpContact = eval("(" + comBrand.cpContact + ")");
txtContact.SetText(cpContact.Name);
txtPhone.SetText(cpContact.Phone);
txtMail.SetText(cpContact.Mail);
txtClientLocation.SetText(cpContact.Location);
//txtContact.SetText(cpContact.Name);
}