27 Aug 2013

What is ASP.NET MVC

ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting.
ASP.NET supports three different development models:
Web Pages, MVC (Model View Controller), and Web Forms.

The MVC Programming Model

MVC is one of three ASP.NET programming models.
MVC is a framework for building web applications using a MVC (Model View Controller) design:
  • The Model represents the application core (for instance a list of database records).
  • The View displays the data (the database records).
  • The Controller handles the input (to the database records).
The MVC model also provides full control over HTML, CSS, and JavaScript.


The MVC model defines web
applications with 3 logic layers:

The business layer (Model logic)
The display layer (View logic)
The input control (Controller logic)

The Model is the part of the application that handles the logic for the application data.
Often model objects retrieve data (and store data) from a database.
The View is the parts of the application that handles the display of the data.
Most often the views are created from the model data.
The Controller is the part of the application that handles user interaction.
Typically controllers read data from a view, control user input, and send input data to the model.
The MVC separation helps you manage complex applications, because you can focus on one aspect a time. For example, you can focus on the view without depending on the business logic. It also makes it easier to test an application.

What is C#?

C# is a modern, general-purpose object oriented programming language developed by Microsoft and approved by Ecma and ISO.
C# was developed by Anders Hejlsberg and his team during the development of .Net Framework.
C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows use of various high-level languages to be used on different computer platforms and architectures.
The following reasons make C# a widely used professional language:

  • Modern, general purpose programming language
  • Object oriented.
  • Component oriented.
  • Easy to learn.
  • Structured language.
  • It produces efficient programs.
  • It can be compiled on a variety of computer platforms.
  • Part of .Net Framework.

Strong Programming Features of C#

Although C# constructs closely follows traditional high level languages C and C++ and being an object oriented programming language, it has strong resemblance with Java, it has numerous strong programming features that make it endearing to multitude of programmers worldwide.
Following is the list of few important features:

  • Boolean Conditions
  • Automatic Garbage Collection
  • Standard Library
  • Assembly Versioning
  • Properties and Events
  • Delegates and Events Management
  • Easy to use Generics
  • Indexers
  • Conditional Compilation
  • Simple Multithreading
  • LINQ and Lambda Expressions
  • Integration with Windows

How to getting Data through web Services with jquery in asp.net c#.

In Html


<div id="div_id"></div>


In Jquery code  JqueryDatabind.js


$.fn.DataBind = function () {    
    var data = "{}";
    var url = "Testing.aspx/get_data";

    $(this).AjaxPOST(url, data, function (d) {
        if (typeof (d[0]) !== 'undefined') {
                $('#div_id').append(d[0].id.toString());
        }
    });
}


In Web Services Code

 public class DataId

 {

     public string id;
 }

[WebMethod]
public List<DataIdget_data()
{
  List<DataId> dataid= new List<DataId>();
  string query = "";
  try
  {
    // pass your Sql  connectionstring  Web.config
   SqlConnection con = new SqlConnection(Pass Your         ConnectionString );
   con.Open();
   query = "select dataid From YourTableName";
   SqlDataAdapter da = new SqlDataAdapter(query, con);
   DataSet ds = new DataSet();
   da.Fill(ds);
   

if(ds.Tables[0].Rows.Count>0)
   {
       DataListId data_list = new DataListId();

       data_list.id= ds.Tables[0].Rows[0]["dataid"].ToString();
       dataid.Add(data_list);
   }
   con.Close();
 }
 catch (Exception ex)
 {
 }
 return dataid;
}

How to export GridView data to excel in asp.net in C#.

 protected void btnexport_Click(object sender, EventArgs e)
 {
        string attachment = "attachment;         filename=RepurchaseRpt".xls";
        Response.Clear();
        Response.AddHeader("content-disposition", attachment);
        Response.Charset = "";
        Response.ContentType = "application/vnd.xls";
        System.IO.StringWriter stringWrite = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
        GridView1.RenderControl(htmlWrite);
        Response.Write(stringWrite.ToString());
        Response.End();
    }
    public override void VerifyRenderingInServerForm(Control control)
    {
    }

How to Create WEBSITE DESIGN

Way2finder Technologies is a web design studio that offers corporate web design and custom web design. Our website designers offer cheap w...