求助 用asp .net显示查询数据库后的结果 最近在研究一个东西,用asp .net显示查询数据库后的结果。用table ,通过列把数据库查出的结果某几个字段显示出来,而且对应某一行还能获得它对应的ID号用来做删除操作。.NETASP数据库 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ajax配合ashx 类似 type: "get", url: encodeURI("../ashx/列表.ashx"), data: { "action": "查看指令列表", "page": page, "flag": flag, "px": px, "cid": num }, cache: false, dataType: "json", beforeSend: function () { $("#e,#f").show(); }, complete: function () { $("#e,#f").hide(); }, success: function (data) { if (data.msg == "0") { alert(data.msgbox); } else if (data.msg == "2") { $("#pd").empty(); $(".fenye").empty(); $(".fenye").html(data.msgbox); } else { $("#pd").empty(); $(data.msgbox).each(function () { $('#pd').append("<tr>" + "<td align='center'>" + this.名称 + "</td>" + "<td align='center'>" + this.数量 + "</td>" + "<td align='center'>" + renderTime(this.时间) + "</td>" + "<td align='center'>" + (this.状态 == 2 ? "<img title='正常' src='../images/icon_correct.png' />" : "<img title='禁用' src='../images/icon_disable.png' />") + "</td>" + "<td align='center'>" + this.批次 + "</td>" + "<td align='center'>" + (this.状态 == 2 ? "<a disabled='disabled'>修改</a>" : "<a href='javascript:void(0)' onfocus='this.blur()' onclick='change($(this)," + this.数量 + "," + this.ID + ")'>修改</a>") + "</td>" + "<td align='center'>" + (this.状态 == 2 ? "<a disabled='disabled'>删除</a>" : "<a href='javascript:void(0)' onfocus='this.blur()' onclick='del($(this)," + this.ID + ")'>删除</a>") + "</td>" + "<td align='center'><a href='javascript:void(0)' onfocus='this.blur()' onclick='state($(this)," + this.ID + ")'>修改生产状态</a></td>" + "</tr>"); }); $(".fenye").empty(); $(".fenye").html(data.msg); $("tr:nth-child(odd)").addClass("tr_odd_bg"); //隔行变色 $("tr").hover( function () { $(this).addClass("tr_hover_col"); }, function () { $(this).removeClass("tr_hover_col"); } ); } }, error: function (error) { alert("error"); } }); 类似<%if (li != null){%><%foreach (fdhost.Model.中间库存 l in li){%><tr><td align="center"><%=l.ID%></td><td align="center"><%=l.名称%></td><td align="center"><%=l.数量%></td></tr><%}%><%}%> 类似function renderTime(date) { var da = new Date(parseInt(date.replace("/Date(", "").replace(")/", "").split("+")[0])); return da.getFullYear() + "-" + (da.getMonth() + 1) + "-" + da.getDate();}function change(obj, num, id) { obj.parent().prev().prev().prev().prev().html("").append("<input type='text' name='ip' value='" + num + "' class='txtInput2 small2' onkeydown='return checkNumber(event);' />"); obj.parent().html("").append("<a href='javascript:void(0)' onfocus='this.blur()' onclick='edit($(this)," + id + ")'>确定</a>");}function edit(obj, id) { var num = obj.parent().prev().prev().prev().prev().children().eq(0).val(); $.ajax({ type: "get", url: encodeURI("../ashx/审核.ashx"), data: { "action": "生产指令内容修改", "num": num, "id": id }, cache: false, dataType: "json", success: function (data) { if (data.msg == "1") { obj.parent().prev().prev().prev().prev().html("").append(num); obj.parent().html("").append("<a href='javascript:void(0)' onfocus='this.blur()' onclick='change($(this)," + num + "," + id + ")'>修改</a>"); } else { alert(data.msgbox); } }, error: function (error) { alert("error"); } });}function del(obj, id) { $.ajax({ type: "get", url: encodeURI("../ashx/审核.ashx"), data: { "action": "生产指令内容删除", "id": id }, cache: false, dataType: "json", success: function (data) { if (data.msg == "1") { obj.parent().parent().remove(); } else { alert(data.msgbox); } }, error: function (error) { alert("error"); } });} 这些那些是在aspx上的?哪些是在aspx.cs上的?请问怎么从aspx调用aspx.cs上的函数返回值,就像jsp那样在页面嵌入代码,.net 可以这样做吗? 在cs文件里public string test="test";前台页面<% =test%>也可以在前台做判断<%if(){ %><input type="text" /><% }%>楼主说的问题可以用服务器控件例如Repeater控件实现 google checkout 401 erro 第一次组建网站的开发队伍 再放100分,数据导出到EXECL的问题。 (急求) 作web安装程序时如何在虚拟目录外创建文件夹,把项目中的文件考过去,想了好久不会!! 怎么样设定DataGrid编辑里的TextBox的宽度! 问下有谁用过uploadify这个控件么 可以填写文本的选择列表是怎么做的? IIS配置问题 谁知道哪儿有“梦龙网络计划”Down ? 用镜像文件安装,系统提示“内部错误2337”是什么意思?怎么解决阿,不然就无法安装了呀 测试数据库链接的问题,有图 求高性能的asp.net全文检索方案
url: encodeURI("../ashx/列表.ashx"),
data: { "action": "查看指令列表", "page": page, "flag": flag, "px": px, "cid": num },
cache: false,
dataType: "json",
beforeSend: function () {
$("#e,#f").show();
},
complete: function () {
$("#e,#f").hide();
},
success: function (data) {
if (data.msg == "0") {
alert(data.msgbox);
}
else if (data.msg == "2") {
$("#pd").empty();
$(".fenye").empty();
$(".fenye").html(data.msgbox);
}
else {
$("#pd").empty();
$(data.msgbox).each(function () {
$('#pd').append("<tr>"
+ "<td align='center'>" + this.名称 + "</td>"
+ "<td align='center'>" + this.数量 + "</td>"
+ "<td align='center'>" + renderTime(this.时间) + "</td>"
+ "<td align='center'>" + (this.状态 == 2 ? "<img title='正常' src='../images/icon_correct.png' />" : "<img title='禁用' src='../images/icon_disable.png' />") + "</td>"
+ "<td align='center'>" + this.批次 + "</td>"
+ "<td align='center'>" + (this.状态 == 2 ? "<a disabled='disabled'>修改</a>" : "<a href='javascript:void(0)' onfocus='this.blur()' onclick='change($(this)," + this.数量 + "," + this.ID + ")'>修改</a>") + "</td>"
+ "<td align='center'>" + (this.状态 == 2 ? "<a disabled='disabled'>删除</a>" : "<a href='javascript:void(0)' onfocus='this.blur()' onclick='del($(this)," + this.ID + ")'>删除</a>") + "</td>"
+ "<td align='center'><a href='javascript:void(0)' onfocus='this.blur()' onclick='state($(this)," + this.ID + ")'>修改生产状态</a></td>"
+ "</tr>");
});
$(".fenye").empty();
$(".fenye").html(data.msg);
$("tr:nth-child(odd)").addClass("tr_odd_bg"); //隔行变色
$("tr").hover(
function () {
$(this).addClass("tr_hover_col");
},
function () {
$(this).removeClass("tr_hover_col");
}
);
}
},
error: function (error) {
alert("error");
}
});
<%if (li != null){%><%foreach (fdhost.Model.中间库存 l in li){%>
<tr>
<td align="center"><%=l.ID%></td>
<td align="center"><%=l.名称%></td>
<td align="center"><%=l.数量%></td>
</tr><%}%><%}%>
function renderTime(date) {
var da = new Date(parseInt(date.replace("/Date(", "").replace(")/", "").split("+")[0]));
return da.getFullYear() + "-" + (da.getMonth() + 1) + "-" + da.getDate();
}function change(obj, num, id) {
obj.parent().prev().prev().prev().prev().html("").append("<input type='text' name='ip' value='" + num + "' class='txtInput2 small2' onkeydown='return checkNumber(event);' />");
obj.parent().html("").append("<a href='javascript:void(0)' onfocus='this.blur()' onclick='edit($(this)," + id + ")'>确定</a>");
}function edit(obj, id) {
var num = obj.parent().prev().prev().prev().prev().children().eq(0).val();
$.ajax({
type: "get",
url: encodeURI("../ashx/审核.ashx"),
data: { "action": "生产指令内容修改", "num": num, "id": id },
cache: false,
dataType: "json",
success: function (data) {
if (data.msg == "1") {
obj.parent().prev().prev().prev().prev().html("").append(num);
obj.parent().html("").append("<a href='javascript:void(0)' onfocus='this.blur()' onclick='change($(this)," + num + "," + id + ")'>修改</a>");
}
else {
alert(data.msgbox);
}
},
error: function (error) {
alert("error");
}
});
}function del(obj, id) {
$.ajax({
type: "get",
url: encodeURI("../ashx/审核.ashx"),
data: { "action": "生产指令内容删除", "id": id },
cache: false,
dataType: "json",
success: function (data) {
if (data.msg == "1") {
obj.parent().parent().remove();
}
else {
alert(data.msgbox);
}
},
error: function (error) {
alert("error");
}
});
}
请问怎么从aspx调用aspx.cs上的函数返回值,就像jsp那样在页面嵌入代码,.net 可以这样做吗?
public string test="test";前台页面
<% =test%>也可以在前台做判断
<%if(){ %>
<input type="text" />
<% }%>
楼主说的问题可以用服务器控件例如Repeater控件实现