Created
June 27, 2013 09:27
-
-
Save mahmut-gundogdu/5875174 to your computer and use it in GitHub Desktop.
asp.net kendi kontrolümüzü yazarken değişkenlerin postback olduktan sonra null olmaması için viewstate de saklanam durumu.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override object SaveViewState() | |
{ | |
//bu fonksyion ile viewstate i kaydediyoruz | |
object[] controlState = new object[4]; | |
controlState[0] = base.SaveViewState(); //kontrolün kendi viewstateleri | |
controlState[1] = this.baslangic;//bizim degiskenimiz | |
controlState[2] = this.bitis;//bizim degiskenimiz | |
controlState[3] = this.coklu;//bizim degiskenimiz | |
return controlState; | |
} | |
protected override void LoadViewState(object state) | |
{ | |
//bu prosedur ile viewsteti geri yüklüyoruz. | |
//Böylece postback sonrası verilrimiz değişkenimize yükleniyor. | |
if (state != null) | |
{ | |
object[] arrState = (object[])state; | |
base.LoadViewState(arrState[0]); | |
this.baslangic = (string)arrState[1]; | |
this.bitis = (string)arrState[2]; | |
this.coklu = (bool)arrState[3]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment