原价<%#Eval("CostPrice")%>现价<%#Eval("Price") %>现在要绑定折扣和节省多少的字段啊,怎么算呢???折扣?????节省??????
解决方案 »
- 求一条SQL语句
- 很多字段要进行“ 数据为空。不能对空值调用此方法或属性”处理 怎么才有更好的处理方法的方法
- asp.net,弹出提示框之后。。。。
- MVC3中如何在一个页面的订单列表中点击同一页面显示订单详细信息
- 有做过MySQL+asp.net 方面的高人没?gridview和mysql总是有问题?
- www.spaces.live.com是否有聚合
- web services 中使用 session 的问题
- 网页打印,如何去掉IE的上页部分
- 简单问题请教,在线等
- 为什么同样的控件一样的CSS样式 在不同页显示不一样
- 使用isapi_rewrite将abc.com 重定向到www.abc.com
- access 数据库问题
前台绑定的时候,要计算这个啊 剩余时间:<br />
<span id="day">00</span> 天 <span id="hour">00</span> 小时 <span id="mini">00</span>
分 <span id="sec">00</span> 秒</p>
这个怎么操作啊·········
<%#(Convert.ToInt32(Eval("Price"))/Convert.ToInt32(Eval("CostPrice"))).ToString()+"%" %>
节省了<%#Convert.ToInt32(Eval("CostPrice"))-Convert.ToInt32(<%#Eval("Price")) %>元。
protact string getzhekou(object price, object costprice)
{
return Convert.ToDecimal(Eval("Price"))/Convert.ToDecimal(Eval("CostPrice")))+"节省了"+Convert.ToDecimal(Eval("CostPrice"))-Convert.ToDecimal(<%#Eval("Price")) ;
}
<%#Convert.ToInt32(Eval("CostPrice"))-Convert.ToInt32(<%#Eval("Price")) %>这一句报错了,是不是写错了啊····
<%#Convert.ToInt32(Eval("CostPrice"))-Convert.ToInt32(Eval("Price")) %>你中间多了个<%#
<span id="year" runat="server"></span>
后台
DateTime BeginTime,EndTime
string year = EndTime.Subtract(BeginTime).Year.ToString()
year.InnerText=year
string day = EndTime.Subtract(BeginTime).Day.ToString()
day.InnerText=day
....依次类推
.aspx<%# GetDisplayContent(Container)%>.csprotected string GetDisplayContent(IDataItemContainer container)
{
YourType o = (YourType)container.DataItem
return String.Format("{0:h'小时'm'分's'秒'}",o.StartTime-o.EndTime);
}
这句什么意思
select Price/CostPrice as 折扣,CostPrice -Price as 节省 from tb
YourType就是你绑定的数据集的实体类型。
如果你绑定的是DataTable,那么YourType就是DataRow,如果你绑定的是实体列表List<T>,那么YourType就是T。
function XX()
{
var o; //折扣
var p; //节约
o=<%#(Convert.ToInt32(Eval("Price"))/Convert.ToInt32(Eval("CostPrice"))).ToString()+"%" %>;
p=<%#Convert.ToInt32(Eval("CostPrice"))-Convert.ToInt32(<%#Eval("Price")) %>;
}
</script>
调用折扣<%=o%>
节省<%=p%>
{
SC_GroupPurchase bll = new SC_GroupPurchase();
DataTable list = bll.GetAllList().Tables[0];
}
我这样把数据读到DataTable 了 接下来肿么办啊········
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>在线日期计算器 时间,日期,天数计算器</title>
<script>
var hzWeek= new Array("日","一","二","三","四","五","六","日");function cweekday(wday){return hzWeek[wday];}
function cala()
{
y=document.getElementById("SY").value;
m=document.getElementById("SM").value;
d=document.getElementById("SD").value;
ddd=document.getElementById("decday").value;ttt=new Date(y,m-1,d).getTime()+ddd*24000*3600;theday=new Date();
theday.setTime(ttt);
document.getElementById("result1").innerHTML=theday.getFullYear()+"年"+(1+theday.getMonth())+"月"+theday.getDate()+"日"+"星期"+cweekday(theday.getDay());
}
function calb()
{y2=document.getElementById("SY2").value;
m2=document.getElementById("SM2").value;
d2=document.getElementById("SD2").value;
y3=document.getElementById("SY3").value;
m3=document.getElementById("SM3").value;
d3=document.getElementById("SD3").value;
day2=new Date(y2,m2-1,d2);
day3=new Date(y3,m3-1,d3);document.getElementById("result2").innerHTML=(day3-day2)/86400000;
}
</script>
<style type="text/css">
<!--
body,td,th {
font-size: 15px;
}
body {
background-color: #99FFFF;
}
-->
</style></head>
<body>
<a href=http://hi.csdn.net/space.php?do=home>yankai159357</a>
<br>
<br>
<b>推算几天后的日期:</b>
<br>
和
<input size=8 id=SY value=2008>年
<input size=4 id=SM value=11>月
<input size=4 id=SD value=27>日
(缺省为今天)
<br>相差
<input size=8 id=decday value=100>天
(输入负数则往前计算)
<br>是:
<span id=result1></span>
<br>
<input type=button value="计算" onclick="cala()">
<br><br>
<b>计算日期差:</b>
<br>
<input size=8 id=SY2 value=2009>年
<input size=4 id=SM2 value=10>月
<input size=4 id=SD2 value=30>日<br>
和 <input size=8 id=SY3 value=2011 >年
<input size=4 id=SM3 value=1>月
<input size=4 id=SD3 value=1>日
<br>相差:
<span id=result2></span>天
<br>
<input type=button value="计算" onclick="calb()">
<br>
<br>
<br>
<br>
<br>
<br>
<a href=http://www.beijing-time.org>返回首页</a>
</bodY>
</html>
{
DataRow row = (DataRow)container.DataItem;
return String.Format("{0:d'天'h'小时'm'分's'秒'}",(DateTime)row["StartTime"]-(DateTime)row["EndTime"];
}
无法将类型为“System.Data.DataRowView”的对象强制转换为类型“System.Data.DataRow”。
···········
报错了
protected string GetDisplayContent(IDataItemContainer container)
{
DataRowView row = (DataRowView)container.DataItem;
return String.Format("{0:d'天'h'小时'm'分's'秒'}",(DateTime)row["StartTime"]-(DateTime)row["EndTime"];
}
折扣的
<%#(Convert.ToInt32(Eval("Price"))/Convert.ToInt32(Eval("CostPrice"))).ToString()+"%" %>
节省的
<%#Convert.ToInt32(Eval("CostPrice"))-Convert.ToInt32(Eval("Price")) %>
看你的精确度了。Convert.ToInt32-->这个类型你自己选择。