标签:
1、JS中使用c#变量 @+变量名
js中变量转换 转为int型:Number(变量名),转为字符串:String("变量名")
2、js弹出窗口传值
父页面:var reValue = window.showModalDialog(‘TotalProgess?id=‘+subStr, obj, ‘dialogWidth=400px;dialogHeight=200px;‘);
父页面使用值:reValue[0],reValue[1] .....
子页面:
var arr = new Array();
arr[0] = _ProcessDescript;
arr[1] = _ProduceDescript;
arr[2] = _DeliverDt;
arr[3] = _Remark;
window.returnValue = arr;
3、SQL拼接字符串:
select ApproveDt=case when ApproveDt<GETDATE() then ‘aa‘ end,
aa=case when DATEDIFF(DAY,ApproveDt,GETDATE())>20 then ‘<span style=‘+‘color: red‘+‘>未开始</span>‘ else ‘11‘ end
from tablename
4、ViewData传递datatable
控制器代码:
List<DataTable> lisdt = new List<DataTable>();
lisdt.Add(dt);
lisdt.Add(dt2);
ViewData["lis"] = lisdt;
视图代码:
@using System.Web;
@model System.Data.DataTable
@using System.Data;
@{List<DataTable> lis = ViewData["lis"] as List<DataTable>;
}
视图跳转页面传递datatable
<table border="0" cellpadding="0" cellspacing="0" width="99%" align="center">
<tr>
<td align="center">
<div id="infoTabs" class="div-tabs" style="width: 99.6%;" align="center">
<ul>
<li><a href="#div_test1">测试1</a></li>
<li><a id="#div_z" href="#div_test2">测试2</a></li>
</ul>
<div id="div_test1">
@Html.Partial("test1", lis[0])
</div>
<div id="div_test2">
@Html.Partial("test2", lis[1])
</div>
</div>
<script type="text/javascript"> $(function () { $(‘#infoTabs‘).tabs({ active: 0 }); }); </script>
</td>
</tr>
</table>
5、SQL合并行
ALTER FUNCTION [dbo].[GetProcessByOrder]
(
@OrderNo varchar(30)
)
RETURNS [nvarchar](4000)
AS
BEGIN
DECLARE @ReturnValue [nvarchar](4000)
SET @ReturnValue = ‘‘
SELECT @ReturnValue=@ReturnValue + RTRIM(LTRIM(state)) + ‘,‘
FROM TableName
WHERE OrderNO = @OrderNo
SET @ReturnValue = substring(@ReturnValue,1,len(@ReturnValue)-1)
RETURN @ReturnValue
END
GO
标签:
原文地址:http://www.cnblogs.com/lovejunjuan/p/4971223.html