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 |