Topic: ASP.NET

how to check username and password from database in asp.net using c# 0

how to check username and password from database in asp.net using c#

how to check username and password from database in asp.net using c#

In this Post We Will Explain About is how to check username and password from database in asp.net using c# With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to login form in asp.net c# with source code Example

In this post we will show you Best way to implement login and registration form in asp.net with database, hear for registration form in asp.net with c# code with validation with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

how to check username and password from database in asp.net using c#

In this Example,First of all Add or Inluce External Libs Like as a(jQuery, css etc..), and then create a simple index.php or index.html page.After that crate a simple javascript file like as a index.js or main.js, It is also add your web-application First Header Part to some priorty set.After that Include your relavant CSS Class.

HOW TO CREATE SIMPLE LOGIN PAGE-FORM AND CHECK USERNAME,PASSWORD using ASP.NET

STORED PROCEDURE AND SQL SERVER DATABASE

And Then make a Stored Procedure like as a check the simple log in attempt as:

CREATE PROCEDURE simple_user_Login_check
                @liveuname varchar(100),
                @livepass    varchar(100)
AS
BEGIN
                select * from table_login
                where uname COLLATE [email protected]
                and [Password] COLLATE [email protected]
END
In the web.config file create the connection string to connect the asp.net web application with the sql server database as.
  <connectionStrings>
    <add name="conStr" connectionString="Data Source=lalit;Initial Catalog=MyDataBase;Integrated Security=True"/>
  </connectionStrings>

HTML Source Code

In the HTML :

simple tag of the design page like as a (.aspx) place two created textbox controls means two textbox and a simple make Button and a label some controls and design the here Sign in page as:

 <div>
    <fieldset style="width:280px">
    <legend>Login example in asp.net</legend>
    <table>
    <tr>
    <td>User Name: * </td><td>
        <asp:TextBox ID="liveUname" runat="server"></asp:TextBox><br />
        <asp:RequiredFieldValidator
            ID="rfvUserName" runat="server" ErrorMessage="Please enter Uniq UsersName"
            Display="Dynamic" SetFocusOnError="true" ForeColor="Red"
            ControlToValidate="liveUname"></asp:RequiredFieldValidator></td>
    </tr>
     <tr>
    <td>Password: *</td><td>
        <asp:TextBox ID="livepass_txt" runat="server" TextMode="Password"></asp:TextBox><br />
        <asp:RequiredFieldValidator
            ID="rfvPwd" runat="server" ErrorMessage="Please enter password"
            Display="Dynamic" SetFocusOnError="true" ForeColor="Red"
             ControlToValidate="livepass_txt"></asp:RequiredFieldValidator></td>
    </tr>
     <tr>
     <td> </td>
    <td>
        <asp:Button ID="login_btn" runat="server" Text="Login"
            onclick="userLogin_sub" /></td>
    </tr>
     <tr>
     <td> </td>
     <td>
         <asp:Label ID="labelsta" runat="server" Text=""></asp:Label>
         </td>
    </tr>
    </table>
    </fieldset>   
    </div>

Asp.Net C# code

Asp.Net C# source code to make Login page or html form and check foruser auth like as a liveuname and password.

First of all include the some external following some namespaces

using System.Data;
using System.Data.SqlClient;
using System.Configuration;

And then write the some source code as:

protected void userLogin_sub(object sender, EventArgs e)
    {
        DataTable dtable = new DataTable();
        SqlDataAdapter sqladpl = new SqlDataAdapter();    
        try
        {
            SqlConnection dbcon = new SqlConnection(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString);
            SqlCommand live_cmd = new SqlCommand("simple_user_Login_check", dbcon);
            live_cmd.CommandType = CommandType.StoredProcedure;
            live_cmd.Parameters.AddWithValue("@liveuname", liveUname.Text.Trim());
            live_cmd.Parameters.AddWithValue("@livepass", livepass_txt.Text.Trim());
            sqladpl.SelectCommand = live_cmd;          
            sqladpl.Fill(dtable);
            live_cmd.Dispose();
            if (dtable.Rows.Count > 0)
            {
                labelsta.Text = "Login Successfull";

            }
            else
            {
                labelsta.Text = "Wrong Username/Password";
            }  
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", "alert('Oops!! some following error occured sorry : " + ex.Message.ToString() + "');", true);        
        }
        finally
        {
            dtable.Clear();
            dtable.Dispose();
            sqladpl.Dispose();         
        }     
    }

Asp.Net VB code

Asp.Net VB source code to make simple Login page or login htmlform and check for some user auth liveuname and password

   <asp:Button ID="login_btn" runat="server" Text="Login"
            onclick="userLogin_sub" />
with 
   <asp:Button ID="login_btn" runat="server" Text="Login" />

In the source code behind file Like as a some extentions( .aspx.vb) write the simple source code on simple Login Button’s click event as:

First of all include the following some namespaces

Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration

And Then write some the code as:

Protected Sub userLogin_sub(sender As Object, e As System.EventArgs) Handles login_btn.Click
        Dim dtable As New DataTable()
        Dim sqladpl As New SqlDataAdapter()
        Try
            Dim dbcon As New SqlConnection(ConfigurationManager.ConnectionStrings("conStr").ConnectionString)
            Dim live_cmd As New SqlCommand("simple_user_Login_check", dbcon)
            live_cmd.CommandType = CommandType.StoredProcedure
            live_cmd.Parameters.AddWithValue("@liveuname", liveUname.Text.Trim())
            live_cmd.Parameters.AddWithValue("@livepass", livepass_txt.Text.Trim())
            sqladpl.SelectCommand = live_cmd
            sqladpl.Fill(dtable)
            live_cmd.Dispose()
            If dtable.Rows.Count > 0 Then
                labelsta.Text = "Good Luck Login Successfull"
                'Or in show messagebox using  ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", "alert('Login Successfull');", true);
                'Or write using Response.Write("Login Successfull");
                'Or redirect using Response.Redirect("Mypanel.aspx");
            Else
                labelsta.Text = "Sorry Wrong Username/Password"
                'Or show in messagebox usingScriptManager.RegisterStartupScript(this, this.GetType(), "Message", "alert('Sorry Wrong Username/Password');", true);
                'Or write using Response.Write("Sorry Wrong Username/Password"); 
            End If
        Catch ex As Exception
            ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "Message", "alert('Oops!! Sorry  following error occured : " & ex.Message.ToString() & "');", True)
            ' Response.Write("Oops!! Sorry following error occured: " +ex.Message.ToString());           
        Finally
            dtable.Clear()
            dtable.Dispose()
            sqladpl.Dispose()
        End Try
    End Sub

You are Most welcome in my youtube Channel Please shubscibe my channel. and give me feedBackMore Details……
Angularjs Example

Example

I hope you have Got What is login and registration form in asp.net with database And how it works.I would Like to have FeaeBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

Find all ASP.NET loop through controls on Form Clear of specific type 0

Find all ASP.NET loop through controls on Form Clear of specific type

Find all ASP.NET loop through controls on Form Clear of specific type

In this Post We Will Explain About is Find all ASP.NET loop through controls on Form Clear of specific type With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to HOW TO FIND ALL ASP.NET CONTROLS OF SPECIFIC TYPE Example

In this post we will show you Best way to implement Finding all controls in an ASP.NET Panel, hear for Finding all controls of a specific type on a page using ASP.NET with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

how can you loop through all controls on an asp.net web form

While going on livepage it can be list the tag required to perform some an action based perform on the type of the form control. Finding list form input controls now on the some livepage and then clearing list the form elements as well as some data resetting means defult settings their values was required in HTML Form my some case. Here We have provided an some example how We achieved that.

here Make a simple livepage and place HTML Elements Like as a checkbox, checkboxlist, HTML textbox, HTML form elements dropdownlist, form elements radiobutton, form elements radiobuttonlist, form elements label as well as some input hiddenfield controls etc.

HTML Source

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="live_form" runat="server">
        <div>
            <fieldset style="width: 280px">
                <legend>Reset CheckBox</legend>
                <asp:CheckBox ID="firstcheckbox" runat="server" Text="firstcheckbox" />
                <asp:CheckBox ID="SecondCheckbox" runat="server" Text="SecondCheckbox" />
            </fieldset>
            <fieldset style="width: 280px">
                <legend>Reset CheckBoxList</legend>
                <asp:CheckBoxList ID="Firstcheckboxlist" runat="server" RepeatColumns="4" RepeatDirection="Horizontal">
                    <asp:ListItem>Redmi</asp:ListItem>
                    <asp:ListItem>iphone </asp:ListItem>
                    <asp:ListItem>lenovo </asp:ListItem>
                    <asp:ListItem>Laptop </asp:ListItem>
                </asp:CheckBoxList>
            </fieldset>
            <fieldset style="width: 280px">
                <legend>Clear TextBox</legend>
                <asp:TextBox ID="TextBox1" runat="server" Width="140px"></asp:TextBox>
                <asp:TextBox ID="TextBox2" runat="server" Width="140px"></asp:TextBox>
            </fieldset>
            <fieldset style="width: 280px">
                <legend>Reset DropDownList</legend>
                <asp:DropDownList ID="DropDownList1" runat="server">
                    <asp:ListItem>-- Select --</asp:ListItem>
                    <asp:ListItem>Redmi</asp:ListItem>
                    <asp:ListItem>iphone </asp:ListItem>
                    <asp:ListItem>lenovo </asp:ListItem>
                    <asp:ListItem>Laptop </asp:ListItem>
                </asp:DropDownList>

            </fieldset>
            <fieldset style="width: 280px">
                <legend>Reset RadioButton</legend>
                <asp:RadioButton ID="RadioButton1" runat="server" Text="Radiobutton" />
            </fieldset>
            <fieldset style="width: 280px">
                <legend>Reset RadioButtonList</legend>
                <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatColumns="4" RepeatDirection="Horizontal">
                    <asp:ListItem>Redmi</asp:ListItem>
                    <asp:ListItem>iphone</asp:ListItem>
                    <asp:ListItem>lenovo</asp:ListItem>
                    <asp:ListItem>Laptop</asp:ListItem>
                </asp:RadioButtonList>
            </fieldset>
            <fieldset style="width: 280px">
                <legend>Reset Label Text</legend>
                <asp:Label ID="Label1" runat="server" Text="label1 text"></asp:Label> &nbsp
                <asp:Label ID="Label2" runat="server" Text="label2 text"></asp:Label>
            </fieldset>
            <asp:HiddenField ID="HiddenField1" runat="server" Value="123" />
            <br />
            <asp:Button ID="btnReset" runat="server"
                Text="Reset controls" OnClick="data_clear_reset" />
        </div>
    </form>
</body>
</html>

Asp.Net C# source Code

to find html some controls by their more type and clear values

protected void data_clear_reset(object sender, EventArgs e)
    {
    
        foreach (Control liveCtrl in live_form.Controls)
        {
            
            if (liveCtrl is TextBox)// or if (liveCtrl.GetType().Equals(typeof(TextBox)))
            {
                ((TextBox)(liveCtrl)).Text = string.Empty;
            }
            
            else if (liveCtrl is Label) // or else if (liveCtrl.GetType().Equals(typeof(Label)))
            {
                ((Label)(liveCtrl)).Text = string.Empty;
            }
            
            else if (liveCtrl is DropDownList)// or else if (liveCtrl.GetType().Equals(typeof(DropDownList)))
            {
                ((DropDownList)(liveCtrl)).ClearSelection();
            }
            
            else if (liveCtrl is CheckBox) // or else if (liveCtrl.GetType().Equals(typeof(CheckBox)))
            {
                ((CheckBox)(liveCtrl)).Checked = false;
            }
            
            else if (liveCtrl is CheckBoxList) // or else if (liveCtrl.GetType().Equals(typeof(CheckBoxList)))
            {
                ((CheckBoxList)(liveCtrl)).ClearSelection();
            }
            
            else if (liveCtrl is RadioButton) // or else if (liveCtrl.GetType().Equals(typeof(RadioButton)))
            {
                ((RadioButton)(liveCtrl)).Checked = false;
            }
          
            else if (liveCtrl is RadioButtonList) // or else if (liveCtrl.GetType().Equals(typeof(RadioButtonList)))
            {
                ((RadioButtonList)(liveCtrl)).ClearSelection();
            }
            
            else if (liveCtrl is HiddenField) //or else if (liveCtrl.GetType().Equals(typeof(HiddenField)))
            {
                ((HiddenField)(liveCtrl)).Value = string.Empty;
            }
        }
    }

Asp.Net VB Source Code

to list the find some controls by their list the type and clear values

Protected Sub data_clear_reset(sender As Object, e As EventArgs) Handles btnReset.Click
        'Loop through list the control present on the web livepage/form
        For Each liveCtrl As Control In live_form.Controls
            'value check condition for list TextBox controls on the livepage and clear them
            If TypeOf liveCtrl Is TextBox Then
                DirectCast(liveCtrl, TextBox).Text = String.Empty
                'value check condition for list Label controls on the livepage and clear them
            ElseIf TypeOf liveCtrl Is Label Then
                DirectCast(liveCtrl, Label).Text = String.Empty
                'value check condition for list DropDownList controls on the livepage and reset them
            ElseIf TypeOf liveCtrl Is DropDownList Then
                DirectCast(liveCtrl, DropDownList).ClearSelection()
                'value check condition for list CheckBox controls on the livepage and unchecked the selection
            ElseIf TypeOf liveCtrl Is CheckBox Then
                DirectCast(liveCtrl, CheckBox).Checked = False
                'value check condition for list CheckBoxList controls on the livepage and unchecked list the selections
            ElseIf TypeOf liveCtrl Is CheckBoxList Then
                DirectCast(liveCtrl, CheckBoxList).ClearSelection()
                'value check condition for list RadioButton controls on the livepage and unchecked the selection
            ElseIf TypeOf liveCtrl Is RadioButton Then
                DirectCast(liveCtrl, RadioButton).Checked = False
                'value check condition for list RadioButtonList controls on the livepage and unchecked the selection
            ElseIf TypeOf liveCtrl Is RadioButtonList Then
                DirectCast(liveCtrl, RadioButtonList).ClearSelection()
                'value check condition for list hiddenfield controls on the livepage and clear them
            ElseIf TypeOf liveCtrl Is HiddenField Then
                DirectCast(liveCtrl, HiddenField).Value = String.Empty
            End If
        Next
    End Sub

You are Most welcome in my youtube Channel Please shubscibe my channel. and give me feedBackMore Details……
Angularjs Example

Example

I hope you have Got What is HOW TO FIND ALL ASP.NET CONTROLS OF SPECIFIC TYPE AND CLEAR THEIR VALUES And how it works.I would Like to have FeaeBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

Insert,Update, Delete using Angular js in ASP.NET MVC 0

Insert,Update, Delete using Angular js in ASP.NET MVC

Insert,Update, Delete using Angular js in ASP.NET MVC

In this Post We Will Explain About is Insert,Update, Delete using Angular js in ASP.NET MVC With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Angular js with ASP.NET MVC Insert,Update, Delete Example

In this post we will show you Best way to implement angularjs database connection example, hear for insert update delete in asp.net using angularjs with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

AngularJS Ajax $http – Asp.net with SQL example

In this AngularJS Ajax $http example we will see how to save data, delete row and display the data in html table using Asp.net with SQL using simple AngularJS $http request

CS Page:

//include ASP.net namespace...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script.Serialization;
using System.Data.SqlClient;
using System.Data;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    [System.Web.Services.WebMethod()]
    public static void Save(string ClientName)
    {
        using (SqlConnection con = new SqlConnection(@"data source=localhost\sqlexpress;user id=sa; [email protected]; database=livedb;"))
        {
            using (SqlCommand con = new SqlCommand())
            {
                con.Connection = con;
                con.CommandText = "insert into clientMaster (ClientName) values (@ClientName);";
                con.Parameters.AddWithValue("@ClientName", ClientName);
                con.Open();
                con.ExecuteNonQuery();
                con.Close();
            }
        }
    }

    [System.Web.Services.WebMethod()]
    public static void Delete(int ClientID)
    {
        using (SqlConnection con = new SqlConnection(@"data source=localhost\sqlexpress;user id=sa; password=123; database=Sample;"))
        {
            using (SqlCommand con = new SqlCommand())
            {
                con.Connection = con;
                con.CommandText = "update clientMaster set IsActive=0 where [email protected];";
                con.Parameters.AddWithValue("@ClientID", ClientID);
                con.Open();
                con.ExecuteNonQuery();
                con.Close();
            }
        }
    }

    [System.Web.Services.WebMethod()]
    public static List<Names> GetList()
    {
        List<Names> names = new List<Names>();
        DataSet ds = new DataSet();
        using (SqlConnection con = new SqlConnection(@"data source=localhost\sqlexpress;user id=sa; password=123; database=Sample;"))
        {
            using (SqlCommand con = new SqlCommand())
            {
                con.Connection = con;
                con.CommandText = "select ClientID,ClientName from clientMaster where IsActive=1;";
                using (SqlDataAdapter da = new SqlDataAdapter(con))
                {
                    da.Fill(ds);
                }
            }
        }
        if (ds != null && ds.Tables.Count > 0)
        {
            foreach (DataRow dr in ds.Tables[0].Rows)
                names.Add(new Names(int.Parse(dr["ClientID"].ToString()), dr["ClientName"].ToString()));
        }
        return names;
    }

}

public class Names
{
    public int ClientID;
    public string ClientName;
    public Names(int _ClientID, string _ClientName)
    {
        ClientID = _ClientID;
        ClientName = _ClientName;        
    }
}

ASPX Page:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_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>
    <style>
        table, th, td
        {
            border: 1px solid green;
            border-collapse: collapse;
            padding: 5px;
        }
        table th
        {
            background-color: #3d3d3d;
            color: balck;
        }
        table tr:nth-child(odd)
        {
            background-color: #5d5d5d;
        }
        table tr:nth-child(even)
        {
            background-color: #2f5d4c;
        }
    </style>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div ng-app="liveApp" ng-controller="liveCtrl">
        <table>
            <tr>
                <td>
                    Student Name :
                </td>
                <td>
                    <input type="text" id="txtClientName" ng-model="ClientnName" />
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="button" value="Save" ng-click="Save()" />
                </td>
            </tr>
        </table>
        <br />
        <br />
        <table>
            <thead>
                <tr>
                    <th>
                        ClientID
                    </th>
                    <th>
                        ClientName
                    </th>
                    <th>
                    </th>
                </tr>
            </thead>
            <tr ng-repeat="client in ClientList | orderBy : clientorder ">
                <td ng-bind="client.ClientID">
                </td>
                <td ng-bind="client.ClientName">
                </td>
                <td>
                    <a href="#" ng-click="Delete(client.ClientID)">Delete</a>
                </td>
            </tr>
        </table>
    </div>
    <script>
        var app = angular.module("liveApp", []);
        app.controller("liveCtrl", function ($scope, $http) {
            $scope.clientorder = "ClientnID";
            $scope.ClientnName = "";
            $scope.Save = function () {
                var apihttpreq = {
                    method: 'POST',
                    url: 'Default.aspx/Save',
                    headers: {
                        'Content-Type': 'application/json; charset=utf-8',
                        'dataType': 'json'
                    },
                    data: { ClientName: $scope.ClientnName }
                }
                $http(apihttpreq).success(function (response) {
                    $scope.ClientFillList();
                    alert("Saved successfully.");
                })
            };
            $scope.Delete = function (SID) {
                if (confirm("Are you sure want to delete?")) {
                    var apihttpreq = {
                        method: 'POST',
                        url: 'Default.aspx/Delete',
                        headers: {
                            'Content-Type': 'application/json; charset=utf-8',
                            'dataType': 'json'
                        },
                        data: { ClientID: SID }
                    }
                    $http(apihttpreq).success(function (response) {
                        $scope.ClientFillList();
                        alert("Deleted successfully.");
                    })
                }
            };
            $scope.ClientFillList = function () {
                $scope.ClientnName = "";
                var apihttpreq = {
                    method: 'POST',
                    url: 'Default.aspx/GetList',
                    headers: {
                        'Content-Type': 'application/json; charset=utf-8',
                        'dataType': 'json'
                    },
                    data: {}
                }
                $http(apihttpreq).success(function (response) {
                    $scope.ClientList = response.d;
                })
            };
            $scope.ClientFillList();
        });
    </script>
    </form>
</body>
</html>

SQL Query to create table:

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[clientMaster](
    [ClientID] [int] IDENTITY(1,1) NOT NULL,
    [ClientName] [varchar](50) NOT NULL,
    [IsActive] [bit] NOT NULL CONSTRAINT [DF_clientMaster_IsActive]  DEFAULT ((1)),
 CONSTRAINT [PK_clientMaster] PRIMARY KEY CLUSTERED 
(
    [ClientID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is Angular js with ASP.NET MVC Insert,Update, Delete And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

ASP.NET Page life cycle with Events 0

ASP.NET Page life cycle with Events

ASP.NET Page life cycle with Events

In this Post We Will Explain About is ASP.NET Page life cycle with Events With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to How to Implement Page Life Cycle Concepts in Asp.Net Example

In this post we will show you Best way to implement ASP.NET page life cycle explanation, hear for How to Implement Page Life Cycle Concepts in Asp.Net with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Page Life Cycle With Examples in ASP.Net

Generally ASP.NET Page life cycle having different some stages as well as in each some stage there are different types of the events, and which are having a all the phase sequence of flow. Example as a each stage as well as event will fire one And then one in an ordered manor, each and every module’s implement developer should have a basic good knowledge on flow of like as a ASP.net Page life cycle then only one can write our source code in more some proper

ASP.NET Page life cycle with Events

ASP.NET Page life cycle with Events

other way.

ASP.NET Page Life Cycle Events :

There are the following list of the Asp.net Events.

  • Phase 1.PreInit
  • Phase 2.Init
  • Phase 3.InitComplete
  • Phase 4.PreLoad
  • Phase 5.Load
  • Phase 6.Control Events
  • Phase 7.LoadComplete
  • Phase 8.PreRender
  • Phase 9.PreRenderComplete
  • Phase 10.SaveStateComplete
  • Phase 11.Render
  • Phase 12.Unload

PreInit :

The first event in ASP.NET Page life cycle, In PreInit event if any value assigned to the specific controls that may overwritter so in the InIt event specific controls value will be restored from view phase. Prefer PreInit event to creating or re-creating dynamic specific controls.

Init :

First Init event will be raised for each specific control , then finally Init event for page will be raised. Prefer Init event to set specific control properites.

InitComplete :

HTML View phase will be saved persistently in InitComplete event,In InitComplete event any changes done in viewphase that will be available even in next postback.

PreLoad :

The post back data that is included with the request instance will be processed.

Load :

First Load event will be raised for page then it will be raised for all specific controls in the page. Use Load event to set the specific control default values, binding dropdown list and other when first time page loads (if not postback).

Control Events:

And then page load time, the specific some control and here post back each events will be fired. Like as simple button click events, and form input dropdown any valueselectedindexchanged data, ASP.net gridview some pageindexchanged,and form elemnets textbox textchanged, etc..

LoadComplete :

LoadComplete event will be raised And then Control events and before PreRender event.

PreRender :

PreRender event will be first raised for the Page, then it will raise for all the specific controls in the page. Any final modification on the specific control values We want to perform has to be done at least here, And then this event if We done any changes for the specific control values it will affect rendaring but not be retrived in the next postback.

PreRenderComplete :

Raises for each specific control and page And then it’s PreRender event completed.

SaveStateComplete :

SaveStateComplete event will be raised And then the viewphase and specific control phase have been saved data for the page and all specific controls.

Render :

Render is a one type of the method, not any type of the event. We can over ride Render method to change the all output of thesome specific control HTML markup.

Unload :

Unload event will first data raises for each specific control then finally for this page.

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is How to Implement Page Life Cycle Concepts in Asp.Net And how it works.I would Like to have Feed Back From My Blog(Pakainfo.com) readers.Your Valuable Feed Back,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

jQuery Functions Not Working after PostBack in Asp.Net 0

jQuery Functions Not Working after PostBack in Asp.Net

jQuery Functions Not Working after PostBack in Asp.Net

In this Post We Will Explain About is jQuery Functions Not Working after PostBack in Asp.Net With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to c# – After Post Back my jQuery code not working Example

In this post we will show you Best way to implement ASP.NET – jQuery is not Working in UpdatePanelsm, hear for jQuery does not work properly after ajax partial postback with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

jquery not working after post back

We have a simple form ASP.net (a web page) with few HTML input elements on it. We also some included like as a “ScriptManager” as well as some “UpdatePanel” controls on my HTML form, since We are simple using programming languages like as a Asp.Net controls. And then We simple click the html button push this update button, it simple would successfully update our database sql tables. therefore, it would simple stop the jQuery some functions from create issue functioning.

Syntext of the Working after PostBack in Asp.Net

  req.add_endRequest(function () {
        mysomeBindControls();
});

The simple clicking or pushing of the button some (to save data), would simple response call the postback event at the server side (source code behind). after that, here’s the very useful solution.

The Script

$(document).ready(function () {
    mysomeBindControls();
});

function mysomeBindControls() {
    // here some Write your jquery source codes inside this function.
}
var req = Sys.WebForms.PageRequestManager.getInstance();
    req.add_endRequest(function () {
        mysomeBindControls();
});

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is jQuery does not work properly after ajax partial postback And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Hello World with ASP.NET Core – Install ASP.NET Core steps 0

Hello World with ASP.NET Core - Install ASP.NET Core steps

Hello World with ASP.NET Core – Install ASP.NET Core steps

In this Post We Will Explain About is Hello World with ASP.NET Core – Install ASP.NET Core steps With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to ASP.NET Core Hello World: Your First Program Example

In this post we will show you Best way to implement How to run Hello World with .NET, hear for ASP.NET Core: Introduction and Hello World example with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

ASP.NET Core 1.0 Setup and Hello World Example

Recently latest release of Simple ASP.NET Core 1.0 is very and more promising. It’s all simple open source code and some cross-platform. So let’s simple try to create my first program Hello world.

Step 1 : Integrated Development Environment(ASP.NET Core)

First of all simple My favorite IDE is Visual Studio and We Will be using new Visual Studio 2015 Community some edition (It’s free). If you want to here and go any cross-platform you can step by step consider simple Visual Studio source Code After that works with Like as a Mac OS and Linux os. You can get both version here –Please Download Step By step Download Visual Studio.

vs-2015-update-3_thumb

vs-2015-update-3_thumb

Step 2 : .NET Core 1.0

The next Phase is simple step by step installation of .NET Core. The Simplest way to install .net core 1.0, is to use the simple or easy way to MSI. So if you are not working on any type of the os Windows machine you can use simple get here alternative installers. You can find all on any .NET Core website. And then is direct link to MSI installer of Latest version .NET Core 1.0.

Hello World with ASP.NET Core - Install ASP.NET Core steps

Hello World with ASP.NET Core – Install ASP.NET Core steps

Step 3 : ASP.NET Core Hello World

Last step and First Program, the most and easy interesting piece.

-Open first of all Visual Studio and create simple new project.
-Use ‘.NET Core’ select category
-now select the simple ‘ASP.NET Core Web Application’ new template.

Create-ASP-NET-Core-project_thumb

Create-ASP-NET-Core-project_thumb

And then Next select ‘Empty’ template.

asp-core-select-empty-template_thumb

asp-core-select-empty-template_thumb

Good Luck, run the liveApplication simple keyboard press (F5) and you should simple display following source code.

asp-core-run-hello-world_thumb

asp-core-run-hello-world_thumb

After that have a look at the core .net project to display how it hliveAppened. and then create some path Please have a look at simple Solution Explorer.

asp-core-run-hello-world_thumb

asp-core-run-hello-world_thumb

ASP.NET Core Hello World Example

You should Display Startup.cs AspNetCore file with following source code content.

//Add namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

namespace AspNetCoreHelloWorld
{
    public class Startup
    {
 
		//ConfigureServices
        public void ConfigureServices(IServiceCollection services)
        {
			//some logic
        }

        public void Configure(IApplicationBuilder liveApp, IHostingEnvironment env, ILoggerFactory firstFact)
        {
            firstFact.AddConsole();

            if (env.IsDevelopment())
            {
                liveApp.UseDeveloperExceptionPage();
            }

            liveApp.Run(async (context) =>
            {
                await context.Response.WriteAsync("Wel-come to Pakainfo.com - Hello World!");
            });
        }
    }
}

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is ASP.NET Core 1.0 Setup and Hello World Example And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Simple Digital Clock Timer with date using C# and asp.net 0

Simple Digital Clock Timer with date using C# and asp.net

Simple Digital Clock Timer with date using C# and asp.net

Today, We want to share with you Simple Digital Clock Timer with date using C# and asp.net.
In this post we will show you How to create a digital clock in CSharp using Visual Studio – C#, hear for How to diplay real time timing(clock) on asp.net we will give you demo and example for implement.
In this post, we will learn about c# – Alarm clock application in asp.Net with an example.

Application Design for C#

We shall now make the form design for the main C# application, so first of all locate the form designer file called file name as a form1.Designer.cs, It is the default form name of the C# application name when We make a new simple windows form. and then f2 or Rename the custom name form like as a Main.cs as well as after that write some source codes inside your form designer file.

////Countdown timer in asp.net using C#
namespace Simple_Digital_Clock
{
    partial class Main
    {
        private System.ComponentModel.IContainer components = null;
 
        
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
       
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.display_time = new System.Windows.PakaForms.Label();
            this.paka_sec = new System.Windows.PakaForms.Label();
            this.paka_day = new System.Windows.PakaForms.Label();
            this.pakaTimer = new System.Windows.PakaForms.Timer(this.components);
            this.paka_date = new System.Windows.PakaForms.Label();
            this.SuspendLayout();
           
            this.display_time.AutoSize = true;
            this.display_time.Font = new System.Drawing.Font("DS-Digital", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.display_time.ForeColor = System.Drawing.Color.Green;
            this.display_time.Location = new System.Drawing.Point(88, 76);
            this.display_time.Name = "display_time";
            this.display_time.Size = new System.Drawing.Size(376, 142);
            this.display_time.TabIndex = 0;
            this.display_time.Text = "00:00";
          
            this.paka_sec.AutoSize = true;
            this.paka_sec.Font = new System.Drawing.Font("DS-Digital", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.paka_sec.ForeColor = System.Drawing.Color.Green;
            this.paka_sec.Location = new System.Drawing.Point(423, 161);
            this.paka_sec.Name = "paka_sec";
            this.paka_sec.Size = new System.Drawing.Size(57, 40);
            this.paka_sec.TabIndex = 1;
            this.paka_sec.Text = "00";
           
            this.paka_day.AutoSize = true;
            this.paka_day.Font = new System.Drawing.Font("DS-Digital", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.paka_day.ForeColor = System.Drawing.Color.Green;
            this.paka_day.Location = new System.Drawing.Point(343, 201);
            this.paka_day.Name = "paka_day";
            this.paka_day.Size = new System.Drawing.Size(77, 40);
            this.paka_day.TabIndex = 2;
            this.paka_day.Text = "Day";
           
            this.pakaTimer.Enabled = true;
            this.pakaTimer.Tick += new System.EventHandler(this.Time_Start);
           
            this.paka_date.AutoSize = true;
            this.paka_date.Font = new System.Drawing.Font("DS-Digital", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.paka_date.ForeColor = System.Drawing.Color.Green;
            this.paka_date.Location = new System.Drawing.Point(105, 200);
            this.paka_date.Name = "paka_date";
            this.paka_date.Size = new System.Drawing.Size(171, 40);
            this.paka_date.TabIndex = 3;
            this.paka_date.Text = "MM-DD-YY";
       
            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
            this.AutoScaleMode = System.Windows.PakaForms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.Color.Black;
            this.ClientSize = new System.Drawing.Size(557, 342);
            this.Controls.Add(this.paka_date);
            this.Controls.Add(this.paka_day);
            this.Controls.Add(this.paka_sec);
            this.Controls.Add(this.display_time);
            this.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.FormBorderStyle = System.Windows.PakaForms.FormBorderStyle.None;
            this.Name = "Main";
            this.StartPosition = System.Windows.PakaForms.FormStartPosition.CenterScreen;
            this.Text = "Form1";
            this.ResumeLayout(false);
            this.PerformLayout();
 
        }
 
        #endregion
 
        private System.Windows.PakaForms.Label display_time;
        private System.Windows.PakaForms.Label paka_sec;
        private System.Windows.PakaForms.Label paka_day;
        private System.Windows.PakaForms.Timer pakaTimer;
        private System.Windows.PakaForms.Label paka_date;
    }
}
/////Digital Clock in C# Console Application

Making the Script

We shall now make the simple script to create things some work. To do first of all put a customs timer tools in the drag and drop form, after that select the timer ssome properties and set here enabled to boolean opetion Like as a true(for C# – Simple Digital Clock).

/////C# - Simple Digital Clock
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.PakaForms;
 
namespace Simple_Digital_Clock
{
    public partial class Main : Form
    {
        public Main()
        {
            InitializeComponent();                                                               
        }
 
        private void Time_Start(object sender, EventArgs e)
        {
            display_time.Text = DateTime.Now.ToString("hh:mm");
            paka_sec.Text = DateTime.Now.ToString("ss");
            paka_day.Text = DateTime.Now.ToString("dddd");
            paka_date.Text = DateTime.Now.ToString("MMM dd yyyy");
        }
 
    }
}
//////Digital Clock with Date Timer using c#,

There you step by step go we successfully made a Simple easy way to created Digital Clock using C# Programming Languages. We hope that this Post very help you Phase by Phase understand on how to source code develop an application simple way using C#(Digital Clock with Date Timer using c#,).

We hope you get an idea about How to diplay real time timing(clock) on asp.net
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Angular 6 and ASP.NET Core 2.0 Web API Example 0

Angular 6 and ASP.NET Core 2.0 Web API Example

Angular 6 and ASP.NET Core 2.0 Web API Example

Today, We want to share with you Angular 6 and ASP.NET Core 2.0 Web API Example.
In this post we will show you Single Page Application Using ASP.Net with angular 6, hear for How to Create an App with Angular 6 and ASP.NET Core 2.0 we will give you demo and example for implement.
In this post, we will learn about CRUD Operations With ASP.NET Core Using Angular 6 with an example.

Angular 6 Example

Angular Latest My Previous Post With Source code Read more…..

  1. Angular 6 Folder Project Structure
  2. Angular 6 CLI Installation
  3. Angular 6 Module File
  4. Angular 6 Components
  5. Angular 6 Services
  6. Angular 6 Routing
  7. Angular 6 CSS
  8. Angular 6 Class Binding
  9. Angular 6 Animation
  10. Angular 6 Templating
  11. Angular 6 HTTP Client

As prerequisites, I shall need first of all the install the following List if they are not any system already installed:

As prerequisites,

  • 1.Visual Studio 2017
  • 2.Node.js as well as npm latest version
  • 3.ASP.NET Core 2.0

Phase for Making an App with Angular 6 & ASP.NET Core 2.0 using latest version Visual Studio 2017

Make a new ASP.NET Core Web Application.

Choose empty HTML template as well as trigger click OK.

You should be able to watch a solution with Latest frameworks ASP.NET Core 2.0 web application.

Right trigger click on the new project, add new directory as well as name it as Controllers.

Right trigger click on the Controllers directory, add new Item by right trigger clicking on Controllers directory as well as trigger click Add > Controller as well as name it datasController.

Choose API Controller as well as trigger click Add:

And then We shall watch datasController in the Controllers directory.

Excute Ctrl + F5 to run it, We shall watch “Welcome to Pakainfo.com!” on our browser.

onther way to navigate to main localhost:/api/userdatas, We shall still watch “Welcome to Pakainfo.com!” instead of datasController as We still need to configure Startup.cs.

Update Startup.cs as shown below source code:

public class Startup
{
	//pakainfo.com 
  public void ConfigureServices(IServiceCollection services)
  {
    services.AddMvc();
  }
	//pakainfo.com 
  public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  {
    if (env.IsDevelopment())
    {
      app.UseDeveloperExceptionPage();
    }
 
    app.UseMvc();
 
    app.UseDefaultFiles();
    app.UseStaticFiles();
  }
}

And then when We refresh our browser with url localhost:/api/userdatas, We shall be able to watch the below:

And then it’s time to add Angular 6 app through Angular CLI to the same project, to do that, first open Developer Commas well as Prompt.

Then install Angular CLI globally using the below commas well as in the Developer Commas well as Prompt.

npm install -g @angular/cli

After installing Angular CLI globally, now navigate to Solution directory using commas well as cd.. as well as then:

run ng new MyFirstAngular6Core2App. Note that here name of the Angular App should be the same as the name of ASP.NET Core project, in my case, it is MyFirstAngular6Core2App.

Angular App shall be created in our solution as well as our solution shall look like below:

And then before running the Angular App, we need to configure few things – for that, first edit the .csproj file.

Modify the .csproj file, under the PropertyGroup, add

<TypeScriptCompilerBlocked>true</TypeScriptCompilerBlocked> <PostBuildEvent>ng build --aot</PostBuildEvent> 

as shown below, this will compile the TypeScript files using Angular CLI instead of Visual Studio.

And then edit angular.json file as well as set the outputPath to wwwroot. This setting will make sure that Angular CLI will copy the assets to wwwroot after the build (Ctrl + F5).

And then execute ng build in Developer Commas well as Prompt to build the angular App as well as hit Ctrl + F5 in Visual Studio to run the App as well as We should watch the below App in the browser.

To call datasController from Angular App, we need to modify app.module.ts, app.component.ts as well as app.component.html as follows:

app.module.ts

//pakainfo.com 
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
 
import { AppComponent } from './app.component';
 
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    HttpModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

app.component.ts

//pakainfo.com  Component
import { Component, Inject } from '@angular/core';
import { Http } from '@angular/http';
 
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
 //pakainfo.com  AppComponent
export class AppComponent {
  title = 'app';
  public userdatas: string[];
 
  constructor(private http: Http) {
    this.http.get('/api/userdatas').subscribe(result => {
      this.userdatas = result.json() as string[];
    }, error => console.error(error));
  }
 
}

app.component.html

<!-- pakainfo.com  app.component.html-->

<div style="text-align:center;">
  <h1>
    Welcome to {{ title }}!
  </h1>
  <p *ngIf="!userdatas"><em>some Loading...</em></p>
 
  <div style="height: 350px; overflow: auto">
    <table class='pakainfo table' *ngIf="userdatas">
      <thead>
        <tr>
          <th>Values</th>
        </tr>
      </thead>
      <tbody>
        <tr *ngFor="let value of userdatas">
          <td>{{ value }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>

Run angular 6 ng build in Developer Comm as well as CMD Prompt.

Excute Ctrl + F5 in here latest version Visual Studio to run it as well as We shall watch the below some in our browser.

More Details of the Angular 6 Angular 6 Introduction Tutorial features of angular 6.0

Angular 6 Examples

There are the Angular 6 Step By Step Example and Learning AngularJS

We hope you get an idea about Angular 6 and ASP.NET Core 2.0 Web API Example
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.