P
prasadrmarathe
Hi,
I have created one custom buton server control which will shown on it
the nuber of time
it was clicked as its text.
I have added the custom control in my another projects tool box but i
am unable to drag the custom control on my webform.
can u please tell what the problem is .
i have provided the code below
thanks.
Prasad.
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace CustomControls
{
/// <summary>
/// Summary description for WebCustomControl1.
/// </summary>
public class CountedButton : System.Web.UI.WebControls.Button
{
//private string text;
public CountedButton( )
{
this.Text = "Click me";
ViewState["Count"] = 0;
}
public int Count
{
get
{
return (int) ViewState["Count"];
}
set
{
ViewState["Count"]=value;
}
}
protected override void OnClick(EventArgs e)
{
ViewState["Count"]=((int)ViewState["Count"]) +1;
this.Text=ViewState["Count"]+ " Clicks";
base.OnClick(e);
}
/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
}
}
I have created one custom buton server control which will shown on it
the nuber of time
it was clicked as its text.
I have added the custom control in my another projects tool box but i
am unable to drag the custom control on my webform.
can u please tell what the problem is .
i have provided the code below
thanks.
Prasad.
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace CustomControls
{
/// <summary>
/// Summary description for WebCustomControl1.
/// </summary>
public class CountedButton : System.Web.UI.WebControls.Button
{
//private string text;
public CountedButton( )
{
this.Text = "Click me";
ViewState["Count"] = 0;
}
public int Count
{
get
{
return (int) ViewState["Count"];
}
set
{
ViewState["Count"]=value;
}
}
protected override void OnClick(EventArgs e)
{
ViewState["Count"]=((int)ViewState["Count"]) +1;
this.Text=ViewState["Count"]+ " Clicks";
base.OnClick(e);
}
/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
}
}