My code for class in App code folder is as
public class Circle
{
public int _Radius;
public float _PI = 3.14F;
public Circle(int Radius)
{
this._Radius = Radius;
}
public string Area()
{
return _PI * _Radius * _Radius;
}
}
and in code behind file i created object of this class as
protected void Page_Load(object sender, EventArgs e)
{
Circle C1 = new Circle(10);
string text = C1.Area;
}
I wanna to display value C1.Area
on label how i do this
Simply assign the output to text property of your ASP Label control like this:-
lblMyLabel.Text = C1.Area();
Here I have considered you Label Control looks like this:-
<asp:Label ID="lblMyLabel" runat="server"></asp:Label>
define a label like this in your .aspx page
<asp:Label ID="lblArea" runat="server" Text=""></asp:Label>
And in code behind assign the value like this
lblArea.Text=C1.Area() ;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.