2014年4月9日 星期三

Horizontal Navigation Bar

資料來源:w3schools
<style> ul { list-style-type:none; margin:0; padding:0; overflow:hidden; } li { float:left; } a:link,a:visited { display:block; width:120px; font-weight:bold; color:#FFFFFF; background-color:#98bf21; text-align:center; padding:4px; text-decoration:none; text-transform:uppercase; } a:hover,a:active { background-color:#7A991A; } </style>
<ul> <li><a href="#home">Home</a></li> <li><a href="#news">News</a></li> <li><a href="#contact">Contact</a></li> <li><a href="#about">About</a></li> </ul>

4 major principles of Object-Oriented Programming

轉貼:4 major principles of Object-Oriented Programming

Encapsulation
Accessor - An accessor is a method that is used to ask an object about itself. In
OOP, these are usually in the form of properties, which have, under
normal conditions, a get method, which is an accessor method.
Mutator - Mutators are public methods that are used to modify
the state of an object, while hiding the implementation of exactly how
the data gets modified.
Abstraction
data abstraction is nothing more than the implementation of
an object that contains the same essential properties and actions we
can find in the original object we are representing.
Inheritance
Objects can relate to eachotherwith either a “has a”, “uses a” or an “is a” relationship.
For example, LibraryAsset is a superclass, or base class, and that maintains
only the data and methods that are common to all loanable assets.
Book, magazine, audiocassette and microfilm will all be subclasses or derived classes
or the LibraryAsset class, and so they inherit these
characteristics.  The inheritance relationship is called the “is
a” relationship.
Polymorphism
Polymorphism means one name, many forms.  Polymorphism
manifests itself by having multiple methods all with the same name, but
slighty different functionality.
There are 2 basic types of polymorphism.  Overridding, also
called run-time polymorphism, and overloading, which is referred to as
compile-time polymorphism.

overriding : 字類別的方法蓋掉父類別的方法。
overloading : 同樣的方法名稱,但因帶的參數不同,而呼叫不同的方法內容。

2014年4月2日 星期三

TextBox.ReadOnly、Attributes["readonly"]及Disabled


http://blog.darkthread.net/post-2009-10-21-textbox-readonly-and-disabled.aspx

TextBox.ReadOnly = true;
TextBox.Attributes.Add("readonly", "readonly");
TextBox.Enabled = false;


在前端用 JavaScript 更改過值後,postback回server端接受的值三者皆不同,如果要收到為 JavaScript 更改過值者,應用 TextBox.Attributes.Add("readonly", "readonly"); 方式。

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 ...