Monday 23 November 2015

Dynamically add controls to PlaceHolder control at run time in asp.net.

Introduction:

I will explain about How to dynamically add controls to PlaceHolder control at run time
in asp.net.

Explanation:

     I am going to create dynamic textbox controls to placeholder with
using PlaceHolder.Controls.Add method.

1.First create placeholder control to source code.

 <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>

2.Create c# code for creating  controls dynamically to place holder.


AdRotator control in Asp.Net

Introduction:

   I will explain here about adrotator control and how to show xml based advertisment file with using adrotator control.

Explanation:

  Adrotator control mainly used to display advertisement files in asp.net page.You can show images and text using adrotator control.You can display advertisment using xml file here i do that how to show advertisment with using xml file.

Global.asax file in Asp.Net.

Introduction:
 
I will explain about what is global.asax file and use of global.asax file.
 
Explanation:

If your application does not have global.asax file you can add  a new item to your ASP.NET application, you get the Add New Item dialog. From here, you can see that you can add a Global Application Class to your applications. This adds a Global.asax file. This file is used by the application to hold application-level events, objects, and variables - all of which are accessible application-wide.

Your ASP.NET applications can have only a single Global.asax file. This file supports a number of items. When it is created, you are given the following template:

Sunday 22 November 2015

Asp.Net Page Directives

Introduction:

Here we are going to discuss about asp.net page directives here I try to explain about different page directive of asp.net page.

Explanation:

 ASP.NET directives are something that is a part of every ASP.NET page. You can control the behavior of your ASP.NET pages by using these directives. Here’s an example of the Page directive:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
    Inherits="_Default" %>

Eleven directives are at your disposal in your ASP.NET pages or user controls. You use these directives in your applications whether the page uses the code-behind model or  the inline coding model.
Basically, these directives are commands that the compiler uses when the page is compiled. Directives are simple to incorporate into your pages. A directive is written in the following format: 

<%@ [Directive] [Attribute=Value] %>

Life Cycle and Events of Asp.Net Page

Introduction:

I will explain here about life cycle and what are the events occur in the life cycle of page.

Explanation:

 Life Cycle of Page

Web page request comes from browser.

•    IIS maps the ASP.NET file extensions to ASPNET_ISAPI.DLL, an ISAPI extension provided with ASP.NET.

•    ASPNET_ISAPI.DLL forwards the request to the ASP.NET worker process (ASPNET_WP.EXE or W3P.EXE).

•    ISAPI loads HTTPRuntime and passes the request to it. Thus, HTTP Pipelining has begun.

•    HTTPRuntime uses HttpApplicationFactory to either create or reuse the HTTPApplication object.

Saturday 21 November 2015

Assembly of dot net



Introduction:

I will explain here what assembly, type of assembly and those operations.

Explanation:

What is an assembly?

•An Assembly is a  logical unit of code
•Assembly physically exist as DLLs or EXEs
•One assembly can contain one or more files
•The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs
•When you compile your source code by default the exe/dll generated is actually an assembly
•Unless your code is bundled as assembly it can not be used in any other application
•When you talk about version of a component you are actually talking about version of the assembly to which the component belongs.
•Every assembly file contains information about itself. This information is called as Assembly Manifest.

Dot Net FrameWork


Introduction:
 
Here I going to explain about basic of dot net framework it is include architecture, security, memory management and version. 
 
Explanation:

 Framework

The Microsoft .NET Framework is a software framework that can be installed on computers running Microsoft Windows operating systems. It includes a large library of coded solutions to common programming problems and a virtual machine that manages the execution of programs written specifically for the framework. The .NET Framework supports multiple programming languages in a manner that allows language interoperability, whereby each language can utilize code written in other languages; in particular, the .NET library is available to all the programming languages that .NET encompasses. The .NET Framework is a Microsoft offering and is intended to be used by most new applications created for the Windows platform. In order to be able to develop and not just run applications for the Microsoft .NET Framework 4.0, it is required to have Microsoft's SDK for Windows 7 and .NET Framework 4 (or newer) or Visual Studio 2010 installed on your computer.

Delete all stored procedure of database using sql query

Introduction:

Here i will show you sql query for how to delete all stored procedure of database with single query

Explanation:

Here i have used cursor to delete all stored procedure of table.You just copy and paste below query to your sql query editor.

USE <database name>
 DECLARE @UserStoredProcedure    VARCHAR(100)
   DECLARE @Command                    VARCHAR(100)
 DECLARE UserStoredProcedureCursor CURSOR SCROLL STATIC READ_ONLY FOR
 SELECT
       SPECIFIC_NAME
   FROM
     INFORMATION_SCHEMA.ROUTINES
   OPEN UserStoredProcedureCursor
   FETCH NEXT FROM UserStoredProcedureCursor
   INTO @UserStoredProcedure
 WHILE (@@FETCH_STATUS = 0) BEGIN
          SET @Command = 'DROP PROCEDURE ' + @UserStoredProcedure

            -- display; visual check
          SELECT @Command
 

Friday 20 November 2015

The foreach loop in asp.net



Introduction:

C# provides four different loops (for, while, do...while, and foreach) that allow us to execute a block of code repeatedly until a certain condition is met.I will explain about the foreach loop here.
 
Explanation:

The foreach loop allows us to iterate through each item in a collection. For the time being we won’t worry about exactly what a collection is—For now, we will just say that it is an object that contains other objects. Technically, to count as a collection, it must support an interface called IEnumerable. Examples of collections include C# arrays, the collection classes in the System.Collection namespaces, and user-defined collection classes. We can get an idea of the syntax of foreach from the following
code, if we assume that fruits is  an string array:

The do while loop in asp.net

Introduction:

C# provides four different loops (for, while, do...while, and foreach) that allow us to execute a block of code repeatedly until a certain condition is met.I will explain about the do while loop here.

Explanation:

The do while  loop’s test condition is evaluated after the body of the loop has been executed. Consequently,do...while loops are useful for situations in which a block of statements must be executed at least one

If the condition is true, the flow of control jumps back up to do, and the statement(s) in the loop execute again. This process repeats until the given condition becomes false.
time, as in this example:

The while loop in asp.net

Introduction:

C# provides four different loops (for, while,do...while, and foreach) that allow us to execute a block of code repeatedly until a certain condition is met.I will explain about the while loop here.

Explanation:

It is like the for loop, while is a pre-test loop. The syntax is similar, but while loops take only one expression:

while(condition)
statement(s);

The for loop in asp.net


Introduction:

C# provides four different loops (for, while,do...while, and foreach) that allow us to execute a block of code repeatedly until a certain condition is met.The for loop is the first that we shall examine here.

Explanation:

C# for loops provide a mechanism for iterating through a loop where we test whether a particular condition holds before we perform another iteration. The syntax is:

for (initializer; condition; iterator)
statement(s)
 
where:

    The initializer is the expression evaluated before the first loop is executed (usually initializing a local variable as a loop counter).

    The condition is the expression that is checked before each new iteration of the loop (this must evaluate to true for another iteration to be performed).

    The iterator is an expression that will be evaluated after each iteration (usually incrementing the loop counter). The iterations end when the condition evaluates to false.

The switch statement in asp.net

Introduction:

 I will explain here what switch case is and how to use in asp.net with c# code.

Explanation:

The switch...case statement is good for selecting one branch of execution from a set of mutually exclusive ones.

It takes the form of a switch argument followed by a series of case clauses. When the expression in the switch argument evaluates to one of the values beside a case clause, the code immediately following the case clause executes. This is one example where we don’t need to use curly braces to join statements into blocks; instead, we mark the end of the code for each case using the break statement. We can also
include a default case in the switch statement, which will execute if the expression evaluates to none of the other cases. The following switch statement tests the value of the integer “A” variable:

Use If statement in asp.net

Introduction:

I going to explain here how to use if statement in asp.net with c# code.

Explanation:

If condition is used to check the condition and execute the statement if condition is  true  then execute statement of true else if condition is false then execute false statement as below syntax.

if (condition)
statement(s)
else
statement(s)

If more than one statement is to be executed as part of either condition, these statements will need to be joined together into a block using curly braces ({ ... })

Calculate loading time of page using javscript

Introduction:

          I am going to explain here how to calculate  page loading time using javascript with help of time function.

Explanation:

Here i calculated before loading and after loading time of page then i reduced time from after loading to before loading,here i used "(new Date()).getTime() " function for calculating time.

I hope you  understand from below code:

Calculate before lading time:

beforeload = (new Date()).getTime();

Calculate after loading time:

afterload = (new Date()).getTime();

Thursday 19 November 2015

Get a selected file name from fileupload control inside the gridview in asp.net

Introduction:

 I will explain here how to getting file upload control's selected file name  inside the grid view  using c#.

Explanation:


Generally we using like this to get selected file name from file upload control   "fileupload1.postedfile.filname " but  it is giving Null value instead of file name so to overcome that issue you can use as below code to get file name

 string FileName= Request.Files[0].FileName.ToString();
 string FileExtension = System.IO.Path.GetExtension(FileName);


Get table's row number in ms sqlserver


Introduction:

             I will explain here how to get  row number of table using sql query.

Explanation:

             If you want to get row number for particular row of table or row numbers of table you can use ROW_NUMBER () key word here i used to show query for getting row number of brcon_tbl where brcate_ID='3'.

SELECT ROW_NUMBER()OVER (ORDER BY brcon_ID) AS Row,brcon_ID  FROM brcon_tbl  WHERE brcate_ID ='3'