Personal use control

xiaoxiao2021-03-06  51

1,

DataGrid

Button control Click, first respond to Click, then Command events. Judgment which button is judged by E.COMMANDNAME;

Add a mandatory version of the button will reverse its Click event to

DataGrid1_itemmnd

event

2, TextBox1 is similar to "Search", the carriage return is performed:

Autopostback = "True"

Processing in the TextBox1_textChanged () event

2,

Multiple TextBox or Button responds to the same event:

Modify the event name:

This.TextBox1.textChanged = New System.EventHandler

TextChanged;

this.TextBox2.textChanged = New System.EventHandler

TextChanged;

definition:

Private Void TextChanged (Object Sender, System.EventArgs E)

{

/ / Method for distinguishing controls

String id = ((TextBox) sender .id;

// String B = ((Button) Sender ;commandname;

Switch (ID)

{

}

}

The WRAP attribute of TextBox decides whether it is automatically wrap.

3, imageButton1 can be used as an image map,

Private void ImageButton1_click (Object Sender, System.Web.ui.ImageClicKeventargs E)

{

INT A = E.x;

INT b = E.Y;

// You can get the position of the mouse click, perform different operations.

}

The AlternateText property is an alternative text that cannot get a picture.

You can also use οnmοuseοver = "b ()" οnmοuseοut = "h ()" to dynamically change the appearance.

4, HyperLink control

Text link: Text

Image Link: ImageURL

If it is simultaneously set, imageurl has high priority. At this time, TEXT appears as a prompt text.

5. Operate the server control in the client JavaScript:

This.button1.attributes.add ("onclick", "Return Upchang ();");

Function upchang ()

{

VAR i =

Document.form1.all ['ListBox1'].

SELECTEDINDEX; if (i> 0)

{

VAR VAL = Document.form1.all ['ListBox1'].

Item (i-1

.value;

Var txt = document.form1.all ['listbox1']. item

(i-1

.TEXT;

Document.form1.all ['ListBox1']. Item (i-1) .value = document.form1.all ['listbox1']. Item (i) .value;

Document.form1.all ['ListBox1']. Item (i-1) .text = document.form1.all ['listbox1']. item (i) .text;

Document.form1.all ['listbox1']. item (i) .value = val; document.form1.all ['listbox1']. Item (i) .text = txt;

Document.form1.all ['ListBox1']. SELECTEDINDEX = I-1;

}

}

转载请注明原文地址:https://www.9cbs.com/read-115855.html

New Post(0)