Thursday, 22 July 2010

IIS Process ID for pool

Run CMD as Administrator,
run C:\Windows\System32\Inetsrv\appcmd.exe LIST WP

Tuesday, 1 June 2010

Değere göre CheckBox'ın seçili olmasını sağlamak

Veritabanında kayıtlı olan değerlere göre CheckBoxListte seçili olarak gelmesini sağlamak.

[C#]
CheckBoxList chkbx = (CheckBoxList)FormView1.FindControl("CheckBoxList1");
 
while (rdr.Read()){
 
ListItem currentCheckBox = chkbx.Items.FindByValue(rdr["ID"].ToString());
 
if (currentCheckBox != null){
currentCheckBox.Selected = true;
}
}

Referans: http://www.mikesdotnetting.com/Article/53/Saving-a-user%27s-CheckBoxList-selection-and-re-populating-the-CheckBoxList-from-saved-data

Monday, 31 May 2010

Sadece rakam girilmesine izin vermek

Form validasyonu yaparken gerekli olabilecek bir fonksiyon. Örneğin, TextBox'a sadece rakam girilebilmesi isteniyorsa, TextBox'ın onkeypress eventi yakalanarak kullanılabilir.

[C#]
txtCompanyPhone.Attributes.Add("onkeypress", "return isNumberKey(event);");

[JavaScript]
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode <> 57))
return false;

return true;
}

Referans: http://www.cambiaresearch.com/c4/029c978b-aac5-472e-97a8-95b256f5febd/How-Can-I-Use-Javascript-to-Allow-Only-Numbers-to-Be-Entered-in-a-TextBox.aspx