טוב את הפוסט הנוכחי החלטתי לכתוב בעברית ולו בגלל הכותרת שלו
לא מזמן שאל אותי אחד הסטודנטים שלימדתי איך הוא יכול לאחסן מידע על זוגות של איברים עבור איזה משחק שהוא קיבל כפרוייקט סיום לקורס
System.Web.UI namespace C#אז הנה פתרון חמוד שמסתבר שקיים ב
:מדובר על שתי מחלקות
Pair,Triplet
: הנה הקוד עבור הראשונה:
public Pair(object x, object y);
public sealed class Triplet
public Triplet(); public Triplet(object x, object y);
public Triplet(object x, object y, object z);
תהנו
Today, I tried to prepare a sample for one of my lectures on ASP.NET. The sample was intended to show the page life cycle in a nutshell. So as an example I simply built up a page and override some of the main stages , like this:
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}
protected override void LoadViewState(object savedState)
{
base.LoadViewState(savedState);
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnChangeLabel_Click(object sender, EventArgs e)
{
lblText.Text = "This is a new data in the label";
}
protected override object SaveViewState()
{
return base.SaveViewState();
}
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
}
I then added a break point to each and every one of these event handlers and showed what happens when the page is running in debug mode. The problem was the LoadViewState did not stop on the break point. As it turns out it will never will unless you will fill the ViewState with some data. So as a workaround I added the following to the Load event handler:
ViewState["test"] = "test";
That indeed solved the problem for me.