Sunday, 23 November 2014
Sunday, 16 November 2014
Sunday, 2 November 2014
Sunday, 26 October 2014
Sunday, 19 October 2014
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).
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.
- <div>
-
- <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
- <br />
-
- <br />
-
- <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
- <br />
- <br />
-
- <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
- <br />
- <br />
-
- <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
- <br />
- </div>
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace WebApplication1
- {
- public partial class _Default : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- Label1.Text = Convert.ToString(Convert.ToInt32(TextBox1.Text) + Convert.ToInt32(TextBox2.Text));
- Session["result"] = Label1.Text;
- Response.Redirect("About.aspx");
- }
- }
- }
STEP:-4 Copy The Code And Paste These Code in About.aspx.
- <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
- <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
- </asp:Content>
STEP:-5 Copy The Code And Paste These Code in About.aspx.cs.
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace WebApplication1
- {
- public partial class About : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- Label1.Text = Session["Result"].ToString();
- }
- }
- }
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***************
- <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
- CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
- <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
- </asp:Content>
- <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
- <h2>
- Welcome to ASP.NET!
- </h2>
- <div style="height: 300px">
- <br/>
-
- <asp:Image ID="Image1" runat="server" ImageUrl="~/Image/SmallLoader.gif" />
- <br />
- Enter Catogary:
- <asp:DropDownList ID="DropDownList1" runat="server">
- <asp:ListItem>Boy</asp:ListItem>
- <asp:ListItem>Girl</asp:ListItem>
- <asp:ListItem>Animal</asp:ListItem>
- </asp:DropDownList>
-
- <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="Small"
- ForeColor="Blue" Text="Please Wait . . ."></asp:Label>
- <br />
-
- <br />
- Sub Catogary:
- <asp:DropDownList ID="DropDownList2" runat="server">
- </asp:DropDownList>
- <br />
- <br />
-
- <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Show" />
-
- <br />
-
- <br />
-
- <br />
- <asp:ScriptManager ID="ScriptManager1" runat="server">
- </asp:ScriptManager>
-
- <asp:Timer ID="Timer1" runat="server" Enabled="False" Interval="6000"
- ontick="Timer1_Tick">
- </asp:Timer>
- </div>
- </asp:Content>
********C# Code***************
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace WebApplication1
- {
- public partial class _Default : System.Web.UI.Page
- {
- int sec = 0;
- protected void Page_Load(object sender, EventArgs e)
- {
- Image1.Visible = false;
- Label1.Visible = false;
- }
- protected void Timer1_Tick(object sender, EventArgs e)
- {
- sec++;
- if (sec == 10)
- {
- }
- Image1.Visible = false;
- Timer1.Enabled = false;
- Label1.Visible = false;
- if (DropDownList1.Text == "Boy")
- {
- DropDownList2.Items.Clear();
- DropDownList2.Items.Add("Ravi");
- DropDownList2.Items.Add("Manoj");
- DropDownList2.Items.Add("Sunil");
- DropDownList2.Items.Add("Rajesh");
- }
- else if (DropDownList1.Text == "Girl")
- {
- DropDownList2.Items.Clear();
- DropDownList2.Items.Add("Soni");
- DropDownList2.Items.Add("Anjali");
- DropDownList2.Items.Add("Neha");
- DropDownList2.Items.Add("Rupa");
- }
- else
- {
- DropDownList2.Items.Clear();
- DropDownList2.Items.Add("Cow");
- DropDownList2.Items.Add("OX");
- DropDownList2.Items.Add("Fox");
- DropDownList2.Items.Add("Cat");
- }
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- Timer1.Enabled = true;
- Image1.Visible = true;
- Label1.Visible=true;
- }
- }
- }
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***************
- <!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 id="Head1" runat="server">
- <title>Check Uncheck all Checkbox in GridView</title>
- <style type="text/css">
- body
- {
- font-family: Arial;
- font-size : 10pt;
- }
- .links
- {
- font-weight: bold;
- }
- </style>
- <script type="text/javascript" src="Scripts/jquery-1.7.1.min.js"></script>
- <script type="text/javascript" language="javascript">
- $(document).ready(function()
- {
- $('#<%=gdRows.ClientID %>').find('input:checkbox[id$="chkParent"]').click(function() {
- var isChecked = $(this).prop("checked");
- $("#<%=gdRows.ClientID %> [id*=chkSelect]:checkbox").prop('checked',isChecked);
- });
- $('#<%=gdRows.ClientID %>').find('input:checkbox[id$="chkSelect"]').click(function() {
- var flag = true;
- $("#<%=gdRows.ClientID %> [id*=chkSelect]:checkbox").each(function() {
- if($(this).prop("checked") == false)
- flag = false;
- });
- $("#<%=gdRows.ClientID %> [id*=chkParent]:checkbox").prop('checked',flag);
- });
- });
- </script>
- </head>
- <body>
- <form id="form1" runat="server">
- <br />
- <br />
- <asp:GridView ID="gdRows" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
- BorderWidth="1px" CellPadding="6" Font-Names="Arial" Font-Size="Small" GridLines="None"
- AutoGenerateColumns="False" ForeColor="Black" Width="36%">
- <FooterStyle BackColor="Tan" />
- <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
- <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
- <HeaderStyle BackColor="Tan" Font-Bold="True" HorizontalAlign="Left" />
- <AlternatingRowStyle BackColor="PaleGoldenrod" />
- <RowStyle HorizontalAlign="Left" />
- <Columns>
- <asp:TemplateField HeaderText=" ">
- <HeaderTemplate>
- <asp:CheckBox ID="chkParent" runat="server" />
- </HeaderTemplate>
- <ItemTemplate>
- <asp:CheckBox ID="chkSelect" runat="server" />
- </ItemTemplate>
- </asp:TemplateField>
- <asp:BoundField ShowHeader="true" DataField="ID" HeaderText="ID"></asp:BoundField>
- <asp:BoundField ShowHeader="true" DataField="ProductName" HeaderText="Product Name">
- </asp:BoundField>
- <asp:BoundField ShowHeader="true" DataField="Quantity" HeaderText="Quantity"></asp:BoundField>
- <asp:BoundField ShowHeader="true" DataField="Price" HeaderText="Price"></asp:BoundField>
- </Columns>
- </asp:GridView>
- </form>
- </body>
- </html>
********C# Code***************
- using System;
- using System.Data;
- using System.Configuration;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- public partial class _Default : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- BindGrid();
- }
- private void BindGrid()
- {
- DataTable dt = new DataTable();
- DataColumn dc;
- dc = new DataColumn();
- dc.ColumnName = "ID";
- dc.DataType = System.Type.GetType("System.Int32");
- dt.Columns.Add(dc);
- dc = new DataColumn();
- dc.ColumnName = "ProductName";
- dt.Columns.Add(dc);
- dc = new DataColumn();
- dc.ColumnName = "Quantity";
- dc.DataType = System.Type.GetType("System.Int32");
- dt.Columns.Add(dc);
- dc = new DataColumn();
- dc.ColumnName = "Price";
- dc.DataType = System.Type.GetType("System.Int32");
- dt.Columns.Add(dc);
- DataRow dr;
- dr = dt.NewRow();
- dr["ID"] = 1;
- dr["ProductName"] = "Mouse";
- dr["Quantity"] = 10;
- dr["Price"] = 100;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["ID"] = 2;
- dr["ProductName"] = "Speaker";
- dr["Quantity"] = 15;
- dr["Price"] = 990;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["ID"] = 3;
- dr["ProductName"] = "Hard Drive";
- dr["Quantity"] = 35;
- dr["Price"] = 3990;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["ID"] = 4;
- dr["ProductName"] = "RAM";
- dr["Quantity"] = 22;
- dr["Price"] = 399;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["ID"] = 5;
- dr["ProductName"] = "Wireless Keyboard";
- dr["Quantity"] = 10;
- dr["Price"] = 3500;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["ID"] = 6;
- dr["ProductName"] = "Wi-Fi Router";
- dr["Quantity"] = 1;
- dr["Price"] = 3990;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["ID"] = 7;
- dr["ProductName"] = "LCD";
- dr["Quantity"] = 62;
- dr["Price"] = 3000;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["ID"] = 8;
- dr["ProductName"] = "Intel Processor";
- dr["Quantity"] = 5;
- dr["Price"] = 7000;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["ID"] = 9;
- dr["ProductName"] = "Monitor";
- dr["Quantity"] = 25;
- dr["Price"] = 1990;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["ID"] = 10;
- dr["ProductName"] = "Keyboard";
- dr["Quantity"] = 20;
- dr["Price"] = 350;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["ID"] = 11;
- dr["ProductName"] = "headphones";
- dr["Quantity"] = 12;
- dr["Price"] = 500;
- dt.Rows.Add(dr);
- gdRows.DataSource = dt;
- gdRows.DataBind();
- }
- }
Subscribe to:
Comments (Atom)













































