CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 how to change label

Print topic Send  topic

Author Message
sksinghddn

Posts: 11
Posted: 12/04/2007, 1:22 AM

dear friends,

sometime very simple problem becomes very complex. it happend to me. i am a new bie for ccs and going step by step tutorial.
now i want to test myself but was fail. i decieded to put a simple button and label on a web page. what i want is to change the value of label on clicking the button i.e.

printed on page with the help of label " button unpresed"
click the button
it should change the label to "button pressed"

please help me. it will clear many my doubts.
View profile  Send private message
bogdantc

Posts: 36
Posted: 12/11/2007, 12:52 AM

I hope you solved your problem but any way here is a 5 minutes solution ... this is the simplest that came into my mind ...

Ingredients: one aspx 2.0 page with C#, one button and two labels ... you'll see immediately why I need two labels ..

Label1 is the one where we show the message ... Label2 we make it invisible and we use it as a counter for even and odd button pressed :) ... the button we use it for pushing :)) ..

Events used :
- BeforeShow for both labels
- Server OnClick for the button

  
//Label Label1 Event BeforeShow. Action Custom Code @7-2A29BDB7  
if(Label1.Text == "")  
	Label1.Text = "Button Unpressed";  
//End Label Label1 Event BeforeShow. Action Custom Code  

  
//Label Label2 Event BeforeShow. Action Custom Code @6-2A29BDB7  
Label2.Visible = false;  
//End Label Label2 Event BeforeShow. Action Custom Code  

  
//Button Button1 Event OnClick. Action Custom Code @4-2A29BDB7  
	if(Label2.Text == "")  
	{  
		Label2.Text = "0";  
	    Label1.Text = "Button Pressed";  
		Label2.Text = "1";  
	}  
	else  
	{  
		if(Convert.ToInt32(Label2.Text) % 2 == 0)  
		{  
			Label1.Text = "Button Pressed";	  
			Label2.Text = (Convert.ToInt32(Label2.Text) + 1).ToString();  
		}  
		else  
		{  
			Label1.Text = "Button Unpressed";  
			Label2.Text = (Convert.ToInt32(Label2.Text) + 1).ToString();  
		}  
	}  
  
//End Button Button1 Event OnClick. Action Custom Code  

I hope it helps you.
_________________
Able was I ere I saw Elba
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.