extjs从数据库中读取数据返回到前台表单,js文件里面怎么写?
publicJsonResultGetUserInfo(){varjson=new{totalProperty=db.t_f_users.Count(),s=(frome...
public JsonResult GetUserInfo()
{
var json = new
{
totalProperty = db.t_f_users.Count(),
s = (from e in db.t_f_users
where e.username ==Session["CurrentUser"].ToString()
select new
{
e.username,
e.userpwd
})
};
return Json(json, JsonRequestBehavior.AllowGet);
} 展开
{
var json = new
{
totalProperty = db.t_f_users.Count(),
s = (from e in db.t_f_users
where e.username ==Session["CurrentUser"].ToString()
select new
{
e.username,
e.userpwd
})
};
return Json(json, JsonRequestBehavior.AllowGet);
} 展开
展开全部
Ext部分:
Ext.onReady(function(){
var myFormPanel = new Ext.form.Panel({
title: 'Client and routing info',
renderTo:Ext.getBody(),
defaults:{
xtype:'textfield'
},
items: [{
fieldLabel: 'Client',
name: 'clientName'
}, {
fieldLabel: 'Port of loading',
name: 'portOfLoading'
}, {
fieldLabel: 'Port of discharge',
name: 'portOfDischarge'
}]
});
myFormPanel.getForm().load({
url: 'page/formload.jsp',
params: {
consignmentRef: 'myConsignmentRef'
},
failure: function(form, action) {
Ext.Msg.alert("Load failed", action.result.errorMessage);
}
});
});
JSP部分
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String forms = "{success: false,errorMessage:'errorMessage',data: {clientName: 'Fred. Olsen Lines',portOfLoading: 'FXT',portOfDischarge: 'OSL'}}";
response.getWriter().write(forms);
%>
Ext.onReady(function(){
var myFormPanel = new Ext.form.Panel({
title: 'Client and routing info',
renderTo:Ext.getBody(),
defaults:{
xtype:'textfield'
},
items: [{
fieldLabel: 'Client',
name: 'clientName'
}, {
fieldLabel: 'Port of loading',
name: 'portOfLoading'
}, {
fieldLabel: 'Port of discharge',
name: 'portOfDischarge'
}]
});
myFormPanel.getForm().load({
url: 'page/formload.jsp',
params: {
consignmentRef: 'myConsignmentRef'
},
failure: function(form, action) {
Ext.Msg.alert("Load failed", action.result.errorMessage);
}
});
});
JSP部分
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String forms = "{success: false,errorMessage:'errorMessage',data: {clientName: 'Fred. Olsen Lines',portOfLoading: 'FXT',portOfDischarge: 'OSL'}}";
response.getWriter().write(forms);
%>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询