What is MVC?

There are four roles in this user interaction paradigm. The human User has a mental model of the information he is currently working with. The object playing the Model role is the computer’s internal and invisible representation of this information. The computer presents different aspects of the information through objects playing the View role, several Views of the same model objects can be visible on the computer screen simultaneously. Objects playing the Controller role translate User commands into suitable messages for the View or Model objects as needed.

Variety ways to do asp.net ajax

There are variety of ways doing ajax implementation. In this section I am going to talk about how to implement different ways of ajax using asp.net and jquery.
  1. Update panel
In the page view you need to use “ScriptManager” and “UpdatePanel” server controls.
Code in page view:
<form id=”form1″ runat=”server”>
<asp:ScriptManager ID=”ScriptManager1″ runat=”server”>
</asp:ScriptManager>
<asp:UpdatePanel ID=”UpdatePanel1″ runat=”server” UpdateMode=”Conditional” RenderMode=”Block”>
<ContentTemplate>
<asp:Label ID=”lbDateTime” runat=”server” ></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID=”btShow” EventName=”Click” />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID=”btShow” runat=”server” Text=”DateTime” onclick=”bt_click” />
</form>
Code behind page:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void bt_click(object sender, EventArgs e)
{
lbDateTime.Text = DateTime.Now.ToShortDateString();
}
}
  1. Client callback method
Code in page view:
<head runat=”server”>
<title>Client Callbacks</title>
<script type=”text/javascript”>
function ReceiveServerData(arg, context) {
Message.innerText = “Date from server: ” + arg;
}
</script>
</head>
<body>
<h2>
Client Callbacks Without Postbacks</h2>
<form id=”form1″ runat=”server”>
<input type=”button” value=”Callback” onclick=”CallServer(‘1′, alert(‘Callback sent to Server’))” />
<br />
<span id=”Message”></span>
</form>
</body>
Code behind page:
protected void Page_Load(object sender, EventArgs e)
{
ClientScriptManager cm = Page.ClientScript;
String cbReference = cm.GetCallbackEventReference(this, “arg”,
“ReceiveServerData”, “”);
String callbackScript = “function CallServer(arg, context) {” +
cbReference + “; }”;
cm.RegisterClientScriptBlock(this.GetType(),
“CallServer”, callbackScript, true);
}
public string GetCallbackResult()
{
// Returns the results of a callback event to the client.
string dateString = DateTime.Now.ToLongDateString();
return dateString;
}
public void RaiseCallbackEvent(String eventArgument)
{
// Processes a callback event on the server using the event
// argument from the client.
string a = “”;
}
  1. Calling web method from javascript
  2. Calling web method from javascript using Jquery