Sunday, August 10, 2008

ASP.NET - Discoveries

im learning asp.net now.. (yeah... 3 years till now... still learning, only now im really serious)

1) a button to reload/refresh a page ..

protected void btnReLoad_Click(object sender, EventArgs e) {
Page.Response.Redirect(Page.Request.Url.ToString(), true);
}

2) i'm learning about hidden ASP field <asp:HiddenField/&amp;gt;, was doing it at home followed the tutorial, no matter what it didint work!, then i tried the sample code, and it works, then i tried to create it again, dont work, then i modified my code following the sample, then it works, then i created it again from scratch, it works..

SO.. moral of the story
1) always copy the function and variable names, (instead of typing) as i suspect that could be the probem
2) when it dont work and u debug and it still dont work, heck, recode, simply and do block testing...

UPDATE: found the fault, it was in the JS! seems
this is CORRECT:- hdn.value = txt.value;

and this is Wrong:- hdn.Value = txt.Value;!!

because of the case the hidden value is not stored to the hidden field.. and i wasted about 2 hours. But good lesson learnt

3) when u make a change to a hidden field, an event it triggered 'onvaluechanged', very interesting

So still learning basic controls. at the moment...

No comments: