When a delete button exists in the gridview, I use btndel to add the event btndel_click to it and output the button run
Then add the gridview1_rowcommand method to output "rowcommand run"
Then add the gridview1_rowdeleting method to output "rowdeleting run"
On the execution page, click Delete. The output order is as follows:
Button run
Rowcommand run
Rowdeleting run
Therefore, we can use these three events to complete deletion. Generally, the first one is not very common and troublesome,
In the second rowcommand, add E. commandargument to the rowcommand and upload the ID to delete it.
The third type of rowdeleteing can be deleted directly. If you do not use the data source control, do not use E. keys, you can use gridview1.datakeys [E. rowindex]. value. tostring () gets the id value, which will be the same later ~ _~
Repeater frontend and backendCodeExecution sequence
The Code on the page is < ASP: repeater ID = " Repundo " Runat = " Server " Onitemdatabound = " Bindundo " > < Itemtemplate >
...
< A href = " Todos_list.aspx " > <% = Newtr %> | <% # Newtr %> <% # Shownum (convert. toint64 (eval ( " Itemid " ))) %> Dinner </ A >
...
</ Itemtemplate > </ ASP: Repeater >
Background code Protected Int Newtr = 0 ;
Protected Void Bindundo ( Object Sender, repeateritemeventargs E)
{
//Newtr = (newtr + 1) % 20;
Newtr=Newtr+200;
//Databinder. eval (E. Item. dataitem ,"");
}
Bind # Region Bind
Protected String Shownum ( Long ID)
{
//Newtr = newtr ++;
Return(++Newtr). tostring ();
}
# Endregion
Running result:
| 402 | 0 | 1 dinner |
|
submitting... please wait the first item |
| 402 | 201 | 202 dinner |
|
submitting... please wait the first item |
This shows that:
1. the eval () method of the binding method of the page is executed first, as shown in <% #... %>.
2. Then run the bindundo method to bind the event.
3. Unified page output variable: Refers to <% =... %> outputting the content in the Variable
Note that:
The first step is to bind a data record. The third step is to output the data after the page is executed.
From the test above, we can infer the design of the execution sequence of Microsoft Asp.net events. First, the page is followed by the background. In fact, I want to bind the page data first and then trigger the event, the background is the method for triggering event execution