1. Change the text on the button
First look at the effect:
1,
2,
3,
One button and one label Control
Code:
Think about it again
Protected Void Button#click ( Object Sender, eventargs E)
{
// Object sender, the object that triggers this event
// E is the parameter that may be passed when this event is triggered.
// Change the dynamic display text of the button
If (Button1.text = " Show Details " )
{
Button1.text = " Hide " ;
Label1.text = " This shows the detailed information: <br/> name: A 1 <br/> Gender: male " ;
}
Else
{
Button1.text = " Show Details " ;
Label1.text = " This is a hidden state! " ;
}
Ii. Use Image to control the production of simple ad Rotation
Code
Code
// Definition range: 0-10
Random random = New Random ();
Int Rannum = Random. Next ( 10 );
If(Rannum< 5)
Linkimage. imageurl=Ima1.gif;
Else
Linkimage. imageurl=Ima2.gif;
3. browser Detection
Browser Detection
Protected Void Button2_click ( Object Sender, eventargs E)
{
Httpbrowsercapabilities Browser = Request. browser;
String Str = " Type: " + Browser. Type + " <Br/> "
+ " Name: " + Browser. Browser + " <Br/> "
+ " Version: " + Browser. Version + " <Br/> "
+ " Platform: " + Browser. Platform;
This . Label2.text = STR; // On the aspx page, you can set its title from the post code because it has runat = server statements.
This. Page. header. Title = "browser detection ";
}
It's very simple and there's no technology at all. Don't laugh!