1、添加时赋值主表id
function add() {
$('#testid').val(document.URL.split("=")[1]);
openwin('dd2');
}
2、下拉框选择产品
1)setcomboboxljx('gg3', 'chanpin_CL.ashx?type=combox1', '产品名称', '产品名称');
2)
function setcomboboxljx(comboxname, myurl, valuename, textname) {
$('#' comboxname).combobox({
url: myurl,
valueField: valuename,
textField: textname,
onSelect: function () {
//alert(myurl);
var g = $('#gg3').combobox('getValue'); //
$.post( 'chanpin_CL.ashx?type=readchanpin&chanpinmc=' g, function (msg) {
var arr = msg.split(',');
$('#txt_sl').val(arr[2]);
$('#gg').val(arr[0]);
});
//var kaoheshezhiH = $('#kaoheshezhiH').combogrid('getValues');
//var str = kaoheshezhiH g;
//str = str.replace(/\s/g, "");
}
});
}
3)后台读数据:
else if (context.Request.QueryString["type"] == "readchanpin")//获取部门信息
{
string chanpinmc = context.Request.QueryString["chanpinmc"];
DataSet ds = bll.GetList("产品名称='" chanpinmc "'");
if (ds.Tables[0].Rows.Count>0)
{
StringBuilder sb = new StringBuilder();
sb.Append(ds.Tables[0].Rows[0]["产品名称"].ToString() ",");
sb.Append(ds.Tables[0].Rows[0]["产品规格"].ToString() ",");
sb.Append(ds.Tables[0].Rows[0]["产品数量"].ToString() ",");
sb.Append(ds.Tables[0].Rows[0]["备注"].ToString() ",");
context.Response.Write(sb.ToString());
}
}