Sunday, 23 November 2014

Steps to use VALIDATIONSUMMARY in ASP.NET.


Objective:-Write a Programme to use the VALIDATIONSUMMARY in ASP.NET.

STEPS :-

STEP:- 0.1  CREATE NEW PROJECT.
Go to File -> New -> Project -> Select asp.net web forms application -> Entry Application Name -> Click OK


 STEPS :-1




  STEPS :-2




  STEPS :-3




  STEPS :-4




  STEPS :-5




  STEPS :-6




  STEPS :-7




 STEPS :-8

Sunday, 16 November 2014

Steps to use REQUIRED FIELD VALIDATOR in ASP.NET.


Objective:-Write a Programme to use the REQUIRED FIELD VALIDATOR in ASP.NET.

STEPS :-

STEP:- 0.1  CREATE NEW PROJECT.
Go to File -> New -> Project -> Select asp.net web forms application -> Entry Application Name -> Click OK.



 STEP:- 1




 STEP:- 2




 STEP:- 3




 STEP:- 4




 STEP:- 5




STEP:- 6

Sunday, 2 November 2014

Steps to use REGULAR EXPRESSION VALIDATOR in ASP.NET.


Objective:-Write a Programme to use the REGULAR EXPRESSION VALIDATOR in ASP.NET.

STEPS :-

STEP:- 0.1  CREATE NEW PROJECT.
Go to File -> New -> Project -> Select asp.net web forms application -> Entry Application Name -> Click OK.


 STEP:- 1




 STEP:- 2




 STEP:- 3




 STEP:- 4




 STEP:- 5




 STEP:- 6




STEP:- 7

Sunday, 26 October 2014

Steps to use RANGEVALIDATOR in ASP.NET.



Objective:-Write a Programme to use the RANGEVALIDATOR in ASP.NET.

STEPS :-

STEP:- 0.1  CREATE NEW PROJECT.
Go to File -> New -> Project -> Select asp.net web forms application -> Entry Application Name -> Click OK.




STEP:- 1




STEP:- 2




STEP:- 3




STEP:- 4




STEP:- 5




STEP:- 6




STEP:- 7




STEP:- 8

Sunday, 19 October 2014

Steps to use COMPAREVALIDATOR in ASP.NET.


Objective:-Write a Programme to use the COMPARE VALIDATOR in ASP.NET.

STEPS :-

STEP:- 0.1  CREATE NEW PROJECT.
Go to File -> New -> Project -> Select asp.net web forms application -> Entry Application Name -> Click OK.




 STEP:- 1




 STEP:- 2




 STEP:- 3




 STEP:- 4




 STEP:- 5




 STEP:- 6




 STEP:- 7




STEP:- 8

Sunday, 12 October 2014

When I Enter Value in Home.aspx it Result will give in About.aspx(Response & Redirect).


Write a Program in ASP.NET That When I Enter Value in Home.aspx it Result will give in About.aspx(Response & Redirect).




STEPS :-


STEP:- 1  CREATE NEW PROJECT.
Go to File -> New -> Project -> Select asp.net web forms application -> Entry Application Name -> Click OK.


STEP:-2 Copy The Code And Paste These Code in Home.aspx.
  1. <div>
  2.     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  3.         <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
  4.         <br />
  5. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  6.         <br />
  7. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  8.         <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
  9.         <br />
  10.         <br />
  11. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  12.         <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
  13.         <br />
  14.         <br />
  15. &nbsp;&nbsp;&nbsp;&nbsp;
  16.         <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
  17.         <br />

  18.     </div>




STEP:-3 Copy The Code And Paste These Code in Home.aspx.cs.

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;

  7. namespace WebApplication1
  8. {
  9.     public partial class _Default : System.Web.UI.Page
  10.     {
  11.         protected void Page_Load(object sender, EventArgs e)
  12.         {

  13.         }

  14.         protected void Button1_Click(object sender, EventArgs e)
  15.         {
  16.             Label1.Text = Convert.ToString(Convert.ToInt32(TextBox1.Text) + Convert.ToInt32(TextBox2.Text));
  17.             Session["result"] = Label1.Text;
  18.             Response.Redirect("About.aspx");

  19.         }
  20.     }
  21. }




STEP:-4 Copy The Code And Paste These Code in About.aspx.
  1. <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
  2.    
  3.         <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
  4.     
  5. </asp:Content>





STEP:-5 Copy The Code And Paste These Code in About.aspx.cs.
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;

  7. namespace WebApplication1
  8. {
  9.     public partial class About : System.Web.UI.Page
  10.     {
  11.         protected void Page_Load(object sender, EventArgs e)
  12.         {
  13.            
  14.             Label1.Text = Session["Result"].ToString();
  15.         }
  16.     }
  17. }

Sunday, 28 September 2014

How to use the combination of Two DropDownList With AJAX Extensions(ScriptManager & Timer).


Objective:-Write a Programme to use the combination of Two DropDownList With AJAX Extensions(ScriptManager & Timer) And Wait gif Animation Image.

STEPS :-
STEP:- 1  CREATE NEW PROJECT.
Go to File -> New -> Project -> Select asp.net web forms application -> Entry Application Name -> Click OK.

STEP:- 2  ADD TOOLS
Drag & Drop these tools which you can see in the Left side of toolbox.
I think this image will help you that which tool you have to Drag & Drop from Toolbox.



STEP:- 3 To Create a folder and keep a image in the folder.
Go to Solution Explorer-> Right clock on WebApplication-> Add-> Click on New Folder
Rename and paste Any Wait gif Animation Image from given link.
http://softbehave.blogspot.in/p/collection-of-loading-image.html



********HTML Code***************

  1. <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
  2.     CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

  3. <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
  4. </asp:Content>
  5. <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
  6.     <h2>
  7.         Welcome to ASP.NET!
  8.     </h2>
  9.     <div style="height: 300px">
  10.     <br/>
  11.     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  12.         <asp:Image ID="Image1" runat="server" ImageUrl="~/Image/SmallLoader.gif" />
  13.         <br />
  14. &nbsp; Enter Catogary:&nbsp;
  15.         <asp:DropDownList ID="DropDownList1" runat="server">
  16.             <asp:ListItem>Boy</asp:ListItem>
  17.             <asp:ListItem>Girl</asp:ListItem>
  18.             <asp:ListItem>Animal</asp:ListItem>
  19.         </asp:DropDownList>
  20. &nbsp;
  21.         <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="Small" 
  22.             ForeColor="Blue" Text="Please Wait . . ."></asp:Label>
  23.         <br />
  24. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  25.         <br />
  26. &nbsp;&nbsp;&nbsp; Sub Catogary:&nbsp;
  27.         <asp:DropDownList ID="DropDownList2" runat="server">
  28.         </asp:DropDownList>
  29.         <br />
  30.         <br />
  31. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  32.         <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Show" />
  33. &nbsp;&nbsp;
  34.         <br />
  35. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  36.         <br />
  37. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  38.         <br />
  39.         <asp:ScriptManager ID="ScriptManager1" runat="server">
  40.         </asp:ScriptManager>
  41. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  42.         <asp:Timer ID="Timer1" runat="server" Enabled="False" Interval="6000" 
  43.             ontick="Timer1_Tick">
  44.         </asp:Timer>
  45.     </div>
  46. </asp:Content>




********C# Code***************

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;

  7. namespace WebApplication1
  8. {
  9.     public partial class _Default : System.Web.UI.Page
  10.     {
  11.         int sec = 0;
  12.         protected void Page_Load(object sender, EventArgs e)
  13.         {
  14.             Image1.Visible = false;
  15.             Label1.Visible = false;
  16.         }

  17.         protected void Timer1_Tick(object sender, EventArgs e)
  18.         {
  19.             sec++;
  20.             if (sec == 10)
  21.             {
  22.                                
  23.             }
  24.             Image1.Visible = false;
  25.             Timer1.Enabled = false;
  26.             Label1.Visible = false;
  27.             if (DropDownList1.Text == "Boy")
  28.             {
  29.                 DropDownList2.Items.Clear();
  30.                 DropDownList2.Items.Add("Ravi");
  31.                 DropDownList2.Items.Add("Manoj");
  32.                 DropDownList2.Items.Add("Sunil");
  33.                 DropDownList2.Items.Add("Rajesh");
  34.             }

  35.             else if (DropDownList1.Text == "Girl")
  36.             {
  37.                 DropDownList2.Items.Clear();
  38.                 DropDownList2.Items.Add("Soni");
  39.                 DropDownList2.Items.Add("Anjali");
  40.                 DropDownList2.Items.Add("Neha");
  41.                 DropDownList2.Items.Add("Rupa");
  42.             }
  43.             else
  44.             {
  45.                 DropDownList2.Items.Clear();
  46.                 DropDownList2.Items.Add("Cow");
  47.                 DropDownList2.Items.Add("OX");
  48.                 DropDownList2.Items.Add("Fox");
  49.                 DropDownList2.Items.Add("Cat");
  50.             }

  51.         }

  52.         protected void Button1_Click(object sender, EventArgs e)
  53.         {
  54.             Timer1.Enabled = true;
  55.             Image1.Visible = true;
  56.             Label1.Visible=true;
  57.         }
  58.     }
  59. }

Saturday, 30 August 2014

How to Check One or More then One GridView Rows In ASP.NET.


Objective:-Write a Programme In ASP.NET to Check One or More then One GridView Rows using jQuery.

STEPS :-
STEP:- 1  CREATE NEW PROJECT.
Go to File -> New -> Project -> Select asp.net web forms application -> Entry Application Name -> Click OK.
STEP:-2 Attach  "jquery-1.7.1.min" file in Scripts Folder




********HTML Code***************

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head id="Head1" runat="server">
  4.     <title>Check Uncheck all Checkbox in GridView</title>
  5.     <style type="text/css">
  6.     body
  7.     {
  8.         font-family: Arial;
  9.         font-size : 10pt;
  10.     }
  11.     .links
  12.     {
  13.         font-weight: bold;
  14.     }
  15.     </style>

  16.     <script type="text/javascript" src="Scripts/jquery-1.7.1.min.js"></script>

  17.     <script type="text/javascript" language="javascript">
  18.     $(document).ready(function() 
  19.     {
  20.         $('#<%=gdRows.ClientID %>').find('input:checkbox[id$="chkParent"]').click(function() {
  21.             var isChecked = $(this).prop("checked");
  22.             $("#<%=gdRows.ClientID %> [id*=chkSelect]:checkbox").prop('checked',isChecked);
  23.         });  
  24.         
  25.         $('#<%=gdRows.ClientID %>').find('input:checkbox[id$="chkSelect"]').click(function() {
  26.             var flag = true;
  27.             $("#<%=gdRows.ClientID %> [id*=chkSelect]:checkbox").each(function() {
  28.                 if($(this).prop("checked") == false)
  29.                     flag = false;
  30.             });
  31.             $("#<%=gdRows.ClientID %> [id*=chkParent]:checkbox").prop('checked',flag);
  32.         });     
  33.     });
  34.     </script>

  35. </head>
  36. <body>
  37.     <form id="form1" runat="server">
  38.         <br />
  39.         <br />
  40.         <asp:GridView ID="gdRows" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
  41.             BorderWidth="1px" CellPadding="6" Font-Names="Arial" Font-Size="Small" GridLines="None"
  42.             AutoGenerateColumns="False" ForeColor="Black" Width="36%">
  43.             <FooterStyle BackColor="Tan" />
  44.             <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
  45.             <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
  46.             <HeaderStyle BackColor="Tan" Font-Bold="True" HorizontalAlign="Left" />
  47.             <AlternatingRowStyle BackColor="PaleGoldenrod" />
  48.             <RowStyle HorizontalAlign="Left" />
  49.             <Columns>
  50.                 <asp:TemplateField HeaderText=" ">
  51.                     <HeaderTemplate>
  52.                         <asp:CheckBox ID="chkParent" runat="server" />
  53.                     </HeaderTemplate>
  54.                     <ItemTemplate>
  55.                         <asp:CheckBox ID="chkSelect" runat="server" />
  56.                     </ItemTemplate>
  57.                 </asp:TemplateField>
  58.                 <asp:BoundField ShowHeader="true" DataField="ID" HeaderText="ID"></asp:BoundField>
  59.                 <asp:BoundField ShowHeader="true" DataField="ProductName" HeaderText="Product Name">
  60.                 </asp:BoundField>
  61.                 <asp:BoundField ShowHeader="true" DataField="Quantity" HeaderText="Quantity"></asp:BoundField>
  62.                 <asp:BoundField ShowHeader="true" DataField="Price" HeaderText="Price"></asp:BoundField>
  63.             </Columns>
  64.         </asp:GridView>
  65.     </form>
  66. </body>
  67. </html>





********C# Code***************

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Web;
  5. using System.Web.Security;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. using System.Web.UI.WebControls.WebParts;
  9. using System.Web.UI.HtmlControls;

  10. public partial class _Default : System.Web.UI.Page
  11. {
  12.     protected void Page_Load(object sender, EventArgs e)
  13.     {
  14.         if (!IsPostBack)
  15.             BindGrid();
  16.     }

  17.     private void BindGrid()
  18.     {
  19.         DataTable dt = new DataTable();
  20.         DataColumn dc;
  21.         dc = new DataColumn();
  22.         dc.ColumnName = "ID";
  23.         dc.DataType = System.Type.GetType("System.Int32");
  24.         dt.Columns.Add(dc);

  25.         dc = new DataColumn();
  26.         dc.ColumnName = "ProductName";
  27.         dt.Columns.Add(dc);

  28.         dc = new DataColumn();
  29.         dc.ColumnName = "Quantity";
  30.         dc.DataType = System.Type.GetType("System.Int32");
  31.         dt.Columns.Add(dc);

  32.         dc = new DataColumn();
  33.         dc.ColumnName = "Price";
  34.         dc.DataType = System.Type.GetType("System.Int32");
  35.         dt.Columns.Add(dc);


  36.         DataRow dr;
  37.         dr = dt.NewRow();
  38.         dr["ID"] = 1;
  39.         dr["ProductName"] = "Mouse";
  40.         dr["Quantity"] = 10;
  41.         dr["Price"] = 100;
  42.         dt.Rows.Add(dr);

  43.         dr = dt.NewRow();
  44.         dr["ID"] = 2;
  45.         dr["ProductName"] = "Speaker";
  46.         dr["Quantity"] = 15;
  47.         dr["Price"] = 990;
  48.         dt.Rows.Add(dr);

  49.         dr = dt.NewRow();
  50.         dr["ID"] = 3;
  51.         dr["ProductName"] = "Hard Drive";
  52.         dr["Quantity"] = 35;
  53.         dr["Price"] = 3990;
  54.         dt.Rows.Add(dr);

  55.         dr = dt.NewRow();
  56.         dr["ID"] = 4;
  57.         dr["ProductName"] = "RAM";
  58.         dr["Quantity"] = 22;
  59.         dr["Price"] = 399;
  60.         dt.Rows.Add(dr);

  61.         dr = dt.NewRow();
  62.         dr["ID"] = 5;
  63.         dr["ProductName"] = "Wireless Keyboard";
  64.         dr["Quantity"] = 10;
  65.         dr["Price"] = 3500;
  66.         dt.Rows.Add(dr);

  67.         dr = dt.NewRow();
  68.         dr["ID"] = 6;
  69.         dr["ProductName"] = "Wi-Fi Router";
  70.         dr["Quantity"] = 1;
  71.         dr["Price"] = 3990;
  72.         dt.Rows.Add(dr);

  73.         dr = dt.NewRow();
  74.         dr["ID"] = 7;
  75.         dr["ProductName"] = "LCD";
  76.         dr["Quantity"] = 62;
  77.         dr["Price"] = 3000;
  78.         dt.Rows.Add(dr);

  79.         dr = dt.NewRow();
  80.         dr["ID"] = 8;
  81.         dr["ProductName"] = "Intel Processor";
  82.         dr["Quantity"] = 5;
  83.         dr["Price"] = 7000;
  84.         dt.Rows.Add(dr);

  85.         dr = dt.NewRow();
  86.         dr["ID"] = 9;
  87.         dr["ProductName"] = "Monitor";
  88.         dr["Quantity"] = 25;
  89.         dr["Price"] = 1990;
  90.         dt.Rows.Add(dr);

  91.         dr = dt.NewRow();
  92.         dr["ID"] = 10;
  93.         dr["ProductName"] = "Keyboard";
  94.         dr["Quantity"] = 20;
  95.         dr["Price"] = 350;
  96.         dt.Rows.Add(dr);

  97.         dr = dt.NewRow();
  98.         dr["ID"] = 11;
  99.         dr["ProductName"] = "headphones";
  100.         dr["Quantity"] = 12;
  101.         dr["Price"] = 500;
  102.         dt.Rows.Add(dr);

  103.         gdRows.DataSource = dt;
  104.         gdRows.DataBind();

  105.     }
  106. }