Execute Action Method

Ratings:
(4)
Views:0
Banner-Img
  • Share this blog:

Understanding action method execution:

2Whenever first time request is coming to sample2 view the request will go to global.asax file check the action method name and control name then control will go to the that action method in the controller execute that action method lode them controller will be return view. After executing the view result will be delivered to client. 2Even when user client on button also same action method will be called 2If we want to call the other action method from the control we use the following procedure.

Learn more about ASP.net Interview Questions in this blog post.
Interested in mastering ASP.net? Check out this blog post to learn more ASP.net Tutorials.

Step1:   create action method with same name as view name with one argument of string type as button name Function name is we find me action method like [accept verbs (http verbs.post)] Public action result view name (string button name) { Code Return view (); } àIn the above example to call the own action method from button “B1”, use the following steps Go to home controller.cs

       ↓

Write the following code [accept verbs (http.verbs.post)] Public action result sample2 (string B1) { View data [“a”] =”welcome sai”; Return view (); } Go to sample2.aspx Write the add the following code in the HTML form <%: view data [“a”] %> Run the application and check

For indepth understanding click on

 

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses

1/15

About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.


Stay Updated


Get stories of change makers and innovators from the startup ecosystem in your inbox