четвер, 29 жовтня 2009 р.

Footer always bottom



HTML:

<div id="container">
<div id="main">
<div id="header">
<h2>
header
</h2>
</div>
<div id="content">
<h2>
content content content content<br />
content content content content<br />
content content content content<br />
content content content content<br />
</h2>
</div>
</div>
</div>
<div id="footer">
<h2>
footer
</h2>
</div>

CSS:

*{padding:0; margin:0;}
html {height: 100%;}
body {height: 100%;}
#container {min-height: 100%;}
* html #container {height: 100%;}
#header {height: 110px;}
#footer {height: 90px;position: relative;margin-top:-90px;}
#main {min-height: 100%;}
* html #main{height: 100%;}
#content {padding-bottom: 90px;}

#header{background:red;}
#container {background:#aaa;}
#content{background:green;}
#footer{background:blue;}

Body min-height 100%


html
{
height:100%;
}
body
{
margin:0px;
min-height:100%;
height:100%;
height:auto !important;
}

Div min-height


#content
{
min-height:400px;
height:auto !important;
height:400px;
}

середа, 29 липня 2009 р.

GridView + autopostback CheckBox


в темплейтах колонок прописуємо:

asp:CheckBox ID="chb1" AutoPostBack="true"
key='<%# Eval("ID") %>'
runat="server"
OnCheckedChanged="chb1_CheckedChanged"

а в коді:
protected void chb1_CheckedChanged(object sender, EventArgs e)
{
CheckBox chb = (CheckBox)sender;
string id = chb.Attributes["key"];
...
}

вівторок, 14 липня 2009 р.

Validation of ViewState Mac failed

Від цієй проблеми допоможуть наступні параметри розділу pages в web.config:

validateRequest="false"
enableEventValidation="false"
viewStateEncryptionMode ="Never"

четвер, 18 червня 2009 р.

asp.net calendar: disable past months


protected void Calendar1_VisibleMonthChanged(object sender, MonthChangedEventArgs e)
{
if (e.NewDate < DateTime.Today)
Calendar1.VisibleDate = DateTime.Today;
}

четвер, 4 червня 2009 р.

Ajax CascadingDropDown: method error 500

Якщо Вы заюзали CascadingDropDown і отримали method error 500,
то потрібно лише додати атрибут
[System.Web.Script.Services.ScriptService()]
до класу вашого сервіса.

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService()]
public class ClientsService : System.Web.Services.WebService
{...}