ASP.NET MVC, MVC, C#, PYTHON, JQUERY

Friday, August 31, 2018

What is Controller in ASP.NET MVC





As you know an MVC application consists of three parts: model, view, and controller. The development of a web application usually required the knowledge of all the three parts.
In ASP.NET MVC Controllers are responsible for processing an incoming user request, executing the appropriate application code and communicating with the model, and rendering the required view.

                            How to Create Controller.

In ASP.NET MVC, controllers handle all incoming request. For creating a controller you need to create a .cs containing the controller class in the controller folder.

public class HomeController :Controller {  //Write Some Code}
Share:

Tuesday, August 28, 2018

Working With HTML and URL Helpers In ASP.NET MVC


ASP.NET MVC  HTML and URL Helpers.

Hello, friends in this article we will learn about HTML and URL Helpers. Consider a situation where the development team working on the e-commerce shopping website application needs to give an option to a user should be able to navigate the different web pages. ASP.NET MVC offers a standard set of helper method. These helpers help you work with HTML and URLs.
The benefits of using these helpers are that they help you generate links and URLs form the routing configuration.

Some HTML Helpers Methods are :

  • Html.ActionLink()
  • Html.BeginForm() and Html.EndForm()
  • Html.Label() and Html.LabelFor()
  • Html.DisplayName() and Html.DisplayNameFor()
  • Html.TextBox() and Html.TextBoxFor()
  • Html.TextArea() and Html.TextAreaFor()
  • Html.EditorFor()
  • Html.Ediotr()
  • Html.Password() and Html.PasswordFor()
  • Html.HiddenFor()
  • Html.CheckBox() and  Html.CheckBoxFor()
  • Html.DropDownList() and Html.DropDownList()
  • Html.RedioButton() and Html.RedioButtonFor()
  • Url.Action()


1. Html.ActionLink()

The Html.ActionLink() Method generates a hyperlink (ancor tag) that points to a controller's action metho.The Html.ActionLink() helper uses the internal rougting process to generate the target URL for the hyperlink.

             The syntax of    Html.ActionLink() 

@Html.ActionLink("Link Text", "ActionName","Controller Name",HtmlAttributes )


This  Html.ActionLink() generate following HTML  markup:

<a href="Controller/ActionName">Link Text</a>
   

2.Html.BeginForm() and Html.EndForm()

The  Html.BeginForm() Method indicate the start of a form. This helper method coordinates with the routing engine to generate a proper URL.

The syntax of  Html.BeginForm() 
    

@{Html.BeginForm("ActionName","Controller Name");}

The preceding syntax will generate the following  markup:

<form action="ControllerName/ActionName" method="post">

Once you created successfully form you need to close the <form> tag by rendering a closing </form> tag. Html.EndForm() Helper method render the form end tag  </form>

In order to avoid to use Html.EndForm()  you can use the following syntax:


@using(Html.BeginForm("ActionName","ControllerName"){

//Write your code here
}

The preceding syntax will generate the following  markup:

<form action="ControllerName/ActionName" >
<!--Write your code here-->
</form>





Share:

Monday, August 27, 2018

How to Count number of rows using jquery.

How to Count number of rows using jquery. ?

Hello friends in this tutorial we will learn about how to count number of row using Jquery.
For  count the number of rows use a selector that will select all the rows and take the lenth.

var myrowcount = $("#tablename tr").lenth;
Share:

Saturday, August 25, 2018

How to send SMTP Email ?

                How to Send Email Using SMTP mail





                        MailMessage mail = new MailMessage();
                        mail.To.Add(item);
                        mail.Subject = subject;
                        mail.Body = message;
                        mail.IsBodyHtml = true;
                        SmtpClient smtp = new SmtpClient();
                        smtp.Host = "smtp.gmail.com";
                        smtp.Port = 587;
                        smtp.UseDefaultCredentials = false;
                        smtp.Credentials = new System.Net.NetworkCredential(email, pass);                                                    smtp.EnableSsl = true;
                        smtp.Send(mail);
Share:

Thursday, August 23, 2018

Naming Conventions in C#


Why Naming Conventions?
Naming Conventions are very important to identify the usage and purpose of a class or a method and to identify the type of variable and arguments.
Types of Naming Conventions Below are the two major parts of Naming Conventions.
  • Pascal Casing (PascalCasing)
  • Camel Casing (camelCasing)
Share:

SOCIAL PROFILES

Search This Blog

Powered by Blogger.

Fixed Menu (yes/no)

yes

Contact Form

Name

Email *

Message *

Tags

Ads Section

Tags

ASP.NET MVC (7) C# (11) jQuery (1)