2014年4月3日 星期四

ASP.NET 使用 Oracle Store Procedure 分頁

INPUT
  PAGE_1:目前頁數
  START_1:開始筆數
  LIMIT_1:每頁幾筆資料
  SORT_1:排序欄位

OUTPUT
  RC_1:總筆數
  TP1025_RTN:回傳資料集

C#
Oracle Store Procedure
結果

RDLC 報表 依條件判斷資料內容靠右



Visual Studio 2013 (MSDN) 改為需要輸入Product key

2012年2月15日 星期三

Masterpage 與 iframe 傳值並刷新母頁面

MasterPage內包一個iframe
iframe傳值至 MasterPage 與刷新 MasterPage 動作
母頁面刷新 => parent.location.reload();
傳值至母頁面
var txt = parent.document.getElementById("ctl00_TextBox6");
txt.value = '12345';

2011年12月14日 星期三

C# 字串修改

string no = "1,2,3,4,5,"; //1,2,3,4,5
no = no.Remove(no.Length - 1);

2011年10月5日 星期三

Regular Expression for Javascript

整數或小數 /^[0-9]+(\.[0-9]+)?$/
整數5位或小數3位 /^[0-9]{1,5}(\.[0-9]{1,3})?$/
整數 /^[0-9]/
<input type="text" name="name1" value ="123" onblur="checkInput(this,this.value)"></input>
<script language="javascript" type="text/javascript">//Added by Sting -- 2011/10/03
function checkInput(obj,v){
v = v.replace(/\,/g, "");
if(v != "")
{
var pattern = new RegExp(/^[0-9]+(\.[0-9]+)?$/);
if(!pattern.test(v)){
alert("Please enter the number!");
obj.select();
return false;
}}}
</script>

2011年3月14日 星期一

NOPI匯出excel

protected void export_excel(DataTable dt, String filename)
{
// 產生 Excel 資料流。
MemoryStream ms = DataTableRenderToExcel.RenderDataTableToExcel(dt) as MemoryStream;
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.CreateSheet("人員清單");
// 建立儲存格樣式
HSSFCellStyle style1 = workbook.CreateCellStyle();
style1.Alignment = HSSFCellStyle.ALIGN_CENTER;
//表頭置中
HSSFRow dataRow = sheet.CreateRow(0);
HSSFCell cell = sheet.CreateRow(0).CreateCell(0);
foreach (DataColumn column in dt.Columns)
{
dataRow.CreateCell(column.Ordinal).SetCellValue(column.ColumnName);
dataRow.GetCell(column.Ordinal).CellStyle = style1;
}
//設定表頭寬度
sheet.SetColumnWidth(0, dt.Columns[0].ToString().Length * 700);
sheet.SetColumnWidth(1, dt.Columns[1].ToString().Length * 1000);
sheet.SetColumnWidth(2, dt.Columns[2].ToString().Length * 1500);
sheet.SetColumnWidth(3, dt.Columns[3].ToString().Length * 3000);
//內容
for (int i = 0; i < dt.Rows.Count; i++)
{
dataRow = sheet.CreateRow(i + 1);
for (int j = 0; j < dt.Columns.Count; j++)
{
dataRow.CreateCell(j).SetCellValue(dt.Rows[i][j].ToString());
}}
workbook.Write(ms);
Response.AddHeader("Content-Disposition", string.Format("attachment; filename=" + System.Web.HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8) + ".xls"));
Response.BinaryWrite(ms.ToArray());
ms.Close();
ms.Dispose();
}