Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Monday, 30 September 2013

Asp.net vs Asp.net MVC

This is taken from different source.


  • ASP.NET is a web framework of Microsoft and MVC is a visual studio code template to  write code using MVC architecture style. The proper name of OLD ASP.NET is “ASP.NET webforms”. So ASP.NET webform is the old ASP.NET with behind code and MVC is the new thing.

accepted
The main advantages of ASP.net MVC are:
  • Enables the full control over the rendered HTML.
  • Provides clean separation of concerns(SoC).Separation of concerns (SoC) • From a technical standpoint, the organization of code within MVC is very clean, organized and granular, making it easier (hopefully) for a web application to scale in terms of functionality. Promotes great design from a development standpoint.
  • Easy integration with JavaScript frameworks.
  • Following the design of stateless nature of the web.
  • RESTful urls that enables SEO.
  • No ViewState and PostBack events
The main advantage of ASP.net Web Form are:
  • It provides RAD development.Rapid Application Development (RAD) • The ability to just 'jump in' and start delivering web forms. This is disputed by some of the MVC community, but pushed by Microsoft. In the end, it comes down to the level of expertise of the developer and what they are comfortable with. The web forms model probably has less of a learning curve to less experienced developers.
  • Easy development model for developers those coming from winform development.

Disadvantages of Asp.net Web forms
  •   Complicated Page Life Cycle
  •   Tight Couping
  •   Html is not the only response type.
  •   Webform is a view first architecture so the view decides which model to connect making the view NOT SO flexible and also involving view in complex decision making. That clearly violates SRP of the SOLID principle read here more about SOLID Principles.
    But if we make action first architecture then the first hits comes to the action and he picks the Model and the view to send different responses.
  • Unit testing is tough



Difference

Asp.Net Web Forms
Asp.Net MVC
Asp.Net Web Form follow a traditional event driven development model.
Asp.Net MVC is a lightweight and follow MVC (Model, View, Controller) pattern based development model.
Asp.Net Web Form has server controls.
Asp.Net MVC has html helpers.
Asp.Net Web Form has state management (like as view state, session) techniques.
Asp.Net MVC has no automatic state management techniques.
Asp.Net Web Form has file-based URLs means file name exist in the URLs must have its physically existence.
Asp.Net MVC has route-based URLs means URLs are divided into controllers and actions and moreover it is based on controller not on physical file.
Asp.Net Web Form follows Web Forms Syntax
Asp.Net MVC follow customizable syntax (Razor as default)
In Asp.Net Web Form, Web Forms(ASPX) i.e. views are tightly coupled to Code behind(ASPX.CS) i.e. logic.
In Asp.Net MVC, Views and logic are kept separately.
Asp.Net Web Form has Master Pages for consistent look and feels.
Asp.Net Web Form has Layouts for consistent look and feels.
Asp.Net Web Form has User Controls for code re-usability.
Asp.Net MVC has Partial Views for code re-usability.

Monday, 23 September 2013

GET VALUE FROM A STORED PROCEDURE


In web config :
Data source--DatabaseServerName
Initial Catalog--Database Name


<connectionStrings>
   
   <add name="ConnectionStringdb" connectionString="Data Source=ANURAG-PC\SQLEXPRESS;Initial Catalog=anurag;Integrated Security=True;" providerName="System.Data.SqlClient" />
   
 </connectionStrings>


==============================================









==============================================

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.IO;
using System.Data;
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!((Page)System.Web.HttpContext.Current.CurrentHandler).IsPostBack)
        {

            string strcon = ConfigurationManager.ConnectionStrings["ConnectionStringdb"].ConnectionString;
            SqlConnection con = new SqlConnection(strcon);
            DataSet ds = new DataSet();
            DataTable dt = new DataTable();
            con.Open();
            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.Connection = con;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "dis";

                // Define the data adapter and fill the dataset 
                using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                {
                    da.Fill(dt);
                }
            }
            GridView1.DataSource = dt.DefaultView;
            GridView1.DataBind();       
        }
    }
       
        
        
}














Saturday, 21 September 2013

ADD CSS TO OUR WEB PAGE

--NORMAL ASPX PAGE
--ONE BUTTON AND ONE TEXT BOX




--Add style sheet here as below



After Save The star mark disappears




Now run



Pretty coollllll :)

--Now why did we make it input in Our style sheet ????

After you run. Just right click and and check view source


The text box and button is rendered as input tag in server.


--Now bring calendar control and drop it in aspx page.


--so our css will not work for the calendar







































































How to Use Themes

How To Add Themes

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="StartOfTutorial._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:Button ID="Button1" runat="server" Text="Button" />
     <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
     </div>
    </form>
</body>
</html>

--execute it













--Now add The skin file as below























skin name i have changed to bluecontrols.skin



























--now in bluecontrols.skin

<asp:Textbox runat="server" BackColor="Blue" BorderStyle="solid"/>
<asp:Button runat="server" BackColor="red" BorderStyle="solid"/>



--then in aspx page























--Run