using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Slaider : System.Web.UI.UserControl { protected int arv = 1; protected int maxarv = 1000000; protected int _laius = 100; public int laius { get { return _laius; } set { _laius = value; muudaArv(kysiArv()); } } public int kysiArv() { return arv; } protected void Page_Load(object sender, EventArgs e) { muudaArv(kysiArv()); } public void muudaArv(int uusArv) { if (uusArv > ylapiir) { return; } arv = uusArv; Label1.Text = arv.ToString(); Image1.ImageUrl = "slaideripilt.aspx?arv=" + arv+ "&laius="+_laius; } public int ylapiir{ get {return maxarv;} set {maxarv = value; } } protected void Button1_Click(object sender, EventArgs e) { muudaArv(kysiArv() - 1); } protected void Button2_Click(object sender, EventArgs e) { muudaArv(kysiArv() + 1); } protected override void OnInit(EventArgs e) { Page.RegisterRequiresControlState(this); base.OnInit(e); } protected override object SaveControlState() { return kysiArv(); } protected override void LoadControlState(object savedState) { muudaArv((int)savedState); } }