"更新URL但不刷新頁面"
說明:
pushState() 的基本參數是:
window.history.pushState(state, title, url);
解決方法:
方法
"window.history.pushState(null, null, "/profile/");"
--匯出-- bcp "select * from [資料庫名稱].[dbo].[資料表名稱]" queryout 匯出檔案名稱.txt -w -U "使用者帳號" -P "使用者密碼" " ...
"更新URL但不刷新頁面"
說明:
pushState() 的基本參數是:
window.history.pushState(state, title, url);
"window.history.pushState(null, null, "/profile/");"
"當匯出的excel格式為3.705E+11,調整可顯示完整"
buttons: [ {extend: 'excelHtml5', filename: 'my_file_name', title: null, exportOptions: { format: { body: function (data, row, column, node ) { return column === 2 ? "\0" + data : data; } } } } ]
如何取得 web.config 裡的 httpRuntime 資訊
說明:
maxRequestLength設定上傳檔案大小(單位是KB)
解決方法:
HttpRuntimeSection section = (HttpRuntimeSection)ConfigurationManager.GetSection("system.web/httpRuntime");
"SQL Update Join"
方法:
UPDATE Table_A
SET Table_A 欄位 = 值
From Table_A a
Left Join Table_B b on a.欄位 =b.欄位
WHERE 條件
(':file').change(function () { //選取類型為file且值發生改變的 var file = this.files[0]; //定義file=發生改的file size = file.size; //size=檔案大小 if (file.size > 3145728) { //假如檔案大小超過300KB (300000/1024) swal('檔案大小上限3MB!!'); //顯示警告!! $(this).val(''); //將檔案欄設為空白 }計算所有file容量大小
$(':file').change(function () { var sizeTotal = 0; $(':file').each(function (index) { //console.log(index + ": " + $(this).attr("id")); var file = this.files[0]; var size = 0; if (this.files.length) { size = file.size; sizeTotal =sizeTotal+ file.size; } //console.log(size); }); //console.log(sizeTotal); if (sizeTotal > 10485760) { swal({ type: 'warning', text: '所有上傳檔案加總限制10MB' }) $(this).val('') };swal 為sweetalert2套件 https://sweetalert2.github.io/
"razor在onclick里輸出內容包含換行符號造成語法異常"
<a onclick="showRemark('@(!string.IsNullOrEmpty(item.Comment) ? item.Comment.Replace("\r\n", " ") : item.Comment)','@item.CommentLastUpdate.ToString("dd-MMM-yyyy",ci)')">Detail</a>
bootstrap點彈跳視窗時,會出現element.style{padding-right:17px} 使整個頁面右邊會越來越往左偏移
說明:
遇到的專案是有使用sweetalert,所以使用方法5的方法有自訂了一下,
不然也可以參考該網址
https://stackoverflow.com/questions/32862394/bootstrap-modals-keep-adding-padding-right-to-body-after-closed
https://forums.oscommerce.com/topic/412058-modal-destination-and-modal-within-modal/
body {
padding-right: 0 !important;
overflow-y: scroll!important;
}
body,body.swal2-shown,body.modal-open {
overflow:inherit;
padding-right:inherit !important;
}
$(document.body).on('hide.bs.modal,hidden.bs.modal', function () {
$('body').css('padding-right', '0');
});
('.modal').on('hide.bs.modal', function (e) {
e.stopPropagation();
$('body').css('padding-right', '');
});
body, body.swal2-shown, body.modal-open {
padding-right: 0 !important;
overflow-y: scroll !important;
}
<ul class="navbar"> <li class="navbar-item"> <a href="javascript:;">Parent Link</a> <ul class="navbar-sub"> <li class="navbar-sub-item"> <a href="#url_redirect">One</a> </li> <li class="navbar-sub-item"> <a href="#url_redirect">Two</a> </li> <li class="navbar-sub-item"> <a href="#url_redirect">Three</a> </li> </ul> </li> <li class="navbar-item"> <a href="javascript:;">Parent Link</a> <ul class="navbar-sub"> <li class="navbar-sub-item"> <a href="#url_redirect">One</a> </li> <li class="navbar-sub-item"> <a href="#url_redirect">Two</a> </li> <li class="navbar-sub-item"> <a href="#url_redirect">Three</a> </li> </ul> </li> <li class="navbar-item"> <a href="javascript:;">Parent Link</a> <ul class="navbar-sub"> <li class="navbar-sub-item"> <a href="#url_redirect">One</a> </li> <li class="navbar-sub-item"> <a href="#url_redirect">Two</a> </li> <li class="navbar-sub-item"> <a href="#url_redirect">Three</a> </li> </ul> </li> <li class="navbar-item"> <a href="javascript:;">Parent Link</a> <ul class="navbar-sub"> <li class="navbar-sub-item"> <a href="#url_redirect">One</a> </li> <li class="navbar-sub-item"> <a href="#url_redirect">Two</a> </li> <li class="navbar-sub-item"> <a href="#url_redirect">Three</a> </li> </ul> </li> </ul>
$('.navbar').on('mouseenter focusin', '.navbar-item > a', function (e) { $(this).parent('.navbar-item') .addClass('active') .siblings('.navbar-item') .removeClass('active') });