2014年4月2日 星期三

JavaScript Get Asp.net Textbox Value | Get Asp.net Label Value in JavaScript

http://www.aspdotnet-suresh.com/2013/10/javascript-get-aspnet-textbox-value-label-value.html

Get label value

var amount = document.getElementById("<%=lblAmount.ClientID %>").innerHTML

Get label value

var name = document.getElementById("<%=txtUserName.ClientID %>").value;


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Get Asp.net Textbox Value in JavaScript</title>
<script type="text/javascript">
function getvalues() {
var name = document.getElementById("<%=txtUserName.ClientID %>").value;
var amount = document.getElementById("<%=lblAmount.ClientID %>").innerHTML;
alert("Textbox Value: "+name+"\n" +"Label Value: "+ amount);
return false
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
UserName:<asp:TextBox ID="txtUserName" runat="server" /><br />
Amount:<asp:Label ID="lblAmount" runat="server" Text="10000"/><br />
<asp:Button ID="btnValidate" runat="server" Text="Get Values" OnClientClick="javascript:getvalues();" />
</div>
</form>
</body>
</html>

2014年4月1日 星期二

GridView show header when no data

要work的三要件:
1. configure ShowHeaderWhenEmpty="True"
2. need
3. run databind()

2014年3月26日 星期三

前端工程日誌: 2013年網頁設計師等級表

前端工程日誌: 2013年網頁設計師等級表: 在教課的這一年來時常會被問到視覺平面設計師假使要跨領域做網頁設計師,究竟要達到什麼樣的水平,才能夠去應徵該職缺。 所以這篇文章是寫給 視覺平面設計師欲轉型為網頁設計師 的參考門檻等級表(HTML、CSS、 JS ),以及一些個人的心得分享, 提供大家參考學習。 J ...

2014年3月23日 星期日

Maximum request length exceeded.


可參考
http://www.cryer.co.uk/brian/mswinswdev/ms_vbnet_server_error_in_application_post_size_exceeded.htm

有時候不一定是下載資料量太大,有可能是 post back 回傳 server 資料量太大,檢查後才發現自己的 case 應該是用了ASP.NET 的 ViewState,把一個 table 記在 ViewState,再次按query查詢時,又把 整個 table 丟回 server ,造成 Maximum request length exceeded.
最後取消用 ViewState,改用按 query時,直接 query db。

2014年3月19日 星期三

padding(內距) 與 margin(外距)


資料來源:http://www.w3schools.com/css/
  • padding(內距) : The padding clears an area around the content (inside the border) of an element. 
  • margin  (外距) : The margin clears an area around an element (outside the border). 



padding/margin基本語法範例:


  • 4個值:上 右 下 左; 2個值:上下 左右; 3個值:上 左右 下; 1個值:四個邊同樣値;


其它值:
ValueDescription
autoThe browser calculates a margin
lengthSpecifies a margin in px, pt, cm, etc. Default value is 0px
%Specifies a margin in percent of the width of the containing element
inheritSpecifies that the margin should be inherited from the parent element

2014年3月18日 星期二

DIV 置中

DIV 置中

參考源原:http://www.wibibi.com/

DIV 置中方式主要是讓整個 DIV 區塊置中
margin:0px auto;   <-- div="" p="">

DIV 內的元素置中,如果你想要讓 DIV 內的文字、圖片或其他元素能夠置中,
text-align:center;    //水平置中對齊
line-height100px; //文字垂直置中

-------------------------------------------
CSS position 

position : absolute;
absolute:絕對位置,當網頁往下拉時,元素也會跟著改變位置,其元素的位置由 top、left、right、bottom 所決定。
fixed:元素位置固定,相對於瀏覽器而定位,其元素的位置由 top、left、right、bottom 所決定。
relative:相對位置,相對於其它元素的位置,其元素的位置由 top、left、right、bottom 所決定。
static:這就是預設值,如果設定 position 為 static,則 top、left、right、bottom 會被忽略。
inherit:繼承自父層 position 定位屬性的值。

-------------------------------------------
CSS float 浮動語法

float: 浮動方向;
 left(靠左浮動)、right(靠右浮動)、none(預設值,也就是不浮動)以及 inherit(繼承自父層的屬性)