Advertisement
| Hall of Fame |
|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: |
//MY COMPLAINT IS THAT THE TEXT BOXES IN THIS SAMPLE (gotton off of MSDN) DO NOT SHOW-UP WHEN I DROP THE CONTROL ONTO A WEB PAGE. I WANT THEM TO BE VISIBLE AT DESIGN-TIME AND WHEN I CLICK ON THEM I WANT TO SEE THEIR PROPERTIES IN THE PROPERTIES WINDOW.
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebControlLibrary1
{
public class Composite : Control, INamingContainer
{
private int number = 100;
private Label label;
public int Number
{
get
{
return number;
}
set
{
number = value;
}
}
private int Sum
{
get
{
EnsureChildControls();
return Int32.Parse(((TextBox)Controls[1]).Text) +
Int32.Parse(((TextBox)Controls[4]).Text);
}
}
public string Text
{
get
{
EnsureChildControls();
return label.Text;
}
set
{
EnsureChildControls();
label.Text = value;
}
}
public event CheckEventHandler Check;
protected virtual void OnCheck(CheckEventArgs ce)
{
if (Check != null)
{
Check(this,ce);
}
}
protected override void CreateChildControls()
{
Controls.Add(new LiteralControl("<h3>Enter a number : "));
TextBox box1 = new TextBox();
box1.Text = "0";
Controls.Add(box1);
Controls.Add(new LiteralControl("</h3>"));
Controls.Add(new LiteralControl("<h3>Enter another number : "));
TextBox box2 = new TextBox();
box2.Text = "0";
Controls.Add(box2);
Controls.Add(new LiteralControl("</h3>"));
Button button1 = new Button();
button1.Text = "Submit";
Controls.Add(new LiteralControl("<br>"));
Controls.Add(button1);
button1.Click += new EventHandler(this.ButtonClicked);
Controls.Add(new LiteralControl("<br><br>"));
label = new Label();
label.Height = 50;
label.Width = 500;
label.Text = "Click the button to see if you won.";
Controls.Add(label);
}
protected override void OnPreRender(EventArgs e)
{
((TextBox)Controls[1]).Text = "0";
((TextBox)Controls[4]).Text = "0";
}
private void ButtonClicked(Object sender, EventArgs e)
{
OnCheck(new CheckEventArgs(Sum - Number));
}
}
}
|