Follow in Twitter & Facebook


Like in Facebook

Powered By Blogger Widgets

Free Download

FREE Tools



Tuesday, July 31, 2012

Difference between Server-Side AJAX framework and Client-side AJAX framework?

- No comments
Ajax:
Ajax stands for Asynchronous Javascript and XML. It uses technologies like HTML/XHTML, CSS, Document Object Model(DOM), XML/XSLT, Javascript and the XMLHttpRequest object.

Asp.Net Ajax:
This component termed by Microsoft that allow us to build rich AJAX enabled web applications, which consists of both server side and client side libraries.

ASP.NET AJAX contains both a server-side Ajax framework and a client-side Ajax framework.

Server-side Ajax framework:
The server-side framework provides developers with an easy way to implement Ajax functionality, without having to possess much knowledge of JavaScript. The framework includes server controls and components and the drag and drop functionality which are popularly known as Asp.Net Ajax Extender controls . This framework is usually preferred when you need to quickly ajaxify an asp.net application.
The disadvantage is that you still need a round trip to the server to perform a client-side action.

- Some of the componet used are: ScriptManager , ScriptManagerProxy, UpdatePanel etc.

- Check an article on Ajax Progress bar in Asp.Net.

Client-side Ajax framework:
The Client-Side Framework allows you to build web applications with rich user-interactivity as that of a desktop application. It contains a set of JavaScript libraries, which is independent from ASP.NET. The library is getting rich in functionality with every new build released.

Monday, July 30, 2012

Access Master Page controls from the Content Page in Asp.Net

- No comments
In this article we will discuss how we can access Master page control values in Content pages in Asp.Net. If you are interested in SharePoint then you can read an article on Master Pages in SharePoint 2010.

Master page has lots of benefits specially if you more than one page needs same looks and feels and functionality in a web site. A very simple example of usage of Master page is for Header and Footer. Normally almost all the pages contains Header and Footer. So it is always good to put that in master page.

Suppose your master page contains some content in a Textbox and You want to retrieve the values in a content page, then you can archive this using 2 ways.

First Approach:
Define one property in the master page like below:

public string ValueOfTextBox
{
    get
    {
        return txtMasterTextBox.Text;
    }

    set
    {
        txtMasterTextBox.Text = value;
    }
}
Now in the content page write the directive statement like below:

<%@ MasterType VirtualPath="~/MasterPage.master" %>

MasterPage.master is the name of the master page.

Not to retrieve the value like below:
Set the value:
Master.ValueOfTextBox = "Write what ever you want";

Get the value:
String text = Master.ValueOfTextBox ;

Second Approach:
In this approach write the code in the content page like below:

<%@ MasterType VirtualPath="~/MasterPage.master" %>

MasterPage.master is the name of the master page.

Now retrieve the values like below:

TextBox textBox = (TextBox)Master.FindControl("txtMasterTextBox");
textBox.Text = "Write what ever you want";

Here txtMasterTextBox is the name of the textbox presented in the master page and whose value we want to get or set.

Sunday, July 29, 2012

Create DataTable Programmatically in C#, ASP.NET

- No comments
Introduction:
In this article we will discuss how to create a data table at runtime using C#.Net in Asp.Net. You can also check my last article on how to create thumbnail at the time of uploading file in Asp.Net fileupload control, Click here.

Description:
We can create Datatable using C#.Net. Below is the syntax:

DataTable table = new DataTable();

//Below we are defining the columns.

table.Columns.Add("ID", typeof(int));
table.Columns.Add("FirstName", typeof(string));
table.Columns.Add("DateOfBirth", typeof(DateTime));
Or also we can use below way to define the column:

DataColumn ID = new DataColumn("ID");
col1.DataType = System.Type.GetType("System.Int");

Here we can add data to the column like below:
table.Rows.Add(25, "SharePointDotnet", DateTime.Now);

Similarly below is an alternative way to add a row:

DataRow row = table.NewRow();
row[ID] = 1100;
row[FirstName] = "SharePointDotnet";
row[DateOfBirth] = "29-07-2012";

SharePoint 2013 Team Site Overview

- No comments
In this video tutorial you will able to know more about SharePoint 2013 Team site overview and also you can check my last article on SharePoint 2013 Download Links. Also you can check SharePoint 2013 search video tutorial here.

This video is presented by Asif Rehmani one of the popular SharePoint trainer.


SharePoint 2013 Search Video Tutorial

- No comments
In this video tutorial we will see an introduction to SharePoint 2013 search. Also you can check SharePoint 2013 Downloads and Links.

Also you can check another video tutorial on SharePoint 2013 Search UI Introduction.

Ajax Progress bar in Asp.Net

- No comments
Intoduction:
In this article we will discuss how to show ajax progress bar while submiting data in Asp.Net. Also you can check some articles on C#.Net, SQL Server and SharePoint 2010.

Description:
Here we will see a progress bar image and Text at the button click.

Here we need to use ScriptManager, UpdatePanel and Update Progress control. We have to use only one ScriptManager in a page.

Saturday, July 28, 2012

File upload and thumbnail creation in Asp.Net

- No comments
Introduction:
In this article we will discuss how to upload file to a specified path and create a thumbnail for the particular image. You can also check an useful article on Cookies in asp.net.

Description:
To upload an image file we will use FileUpload asp.net control which is available in Visual studio toolbax. Also here we will check the size of the image and the extension also.

HTML Code:
<asp:FileUpload ID="FileUpload1" runat="server" Width="300px" />
<br />
<asp:Button ID="btnUpload" runat="server" EnableViewState="true" Text="Upload" OnClick="btnUpload_Click" />
<br />
<asp:Label ID="lblStatus" runat="server" Text="" ForeColor="Red"></asp:Label>

Here in the above code we have one upload button and one lebel to show any error message.

C#.Net Code:
Button Click Code
try
        {
            if (FileUpload1.PostedFile != null)
            {
                int fileSize = FileUpload1.PostedFile.ContentLength;
                if (fileSize > 524288)
                {
                    lblStatus.Text = "Please upload file with maximum size 0.5MB";
                    return;
                }
                string extension = Path.GetExtension(FileUpload1.PostedFile.FileName);

                ArrayList arrExtensionList = new ArrayList();
                arrExtensionList.Add(".png");
                arrExtensionList.Add(".jpg");
                arrExtensionList.Add(".jpeg");
                arrExtensionList.Add(".bmp");
                arrExtensionList.Add(".gif");
                arrExtensionList.Add(".tif");

                if (!arrExtensionList.Contains(extension.ToLower()))
                {
                    lblStatus.Text = "Please upload a valid image file. (.png,.jpg,.jpeg,.bmp,.gif,.tif)";
                    return;
                }



                string ImageName = "SampleImage1.png";
                FileUpload1.SaveAs(Server.MapPath("~\\UserPhoto\\") + ImageName);
                string ThumbnailPath = (Server.MapPath("~\\UserPhoto\\MyImage.png");
                using (System.Drawing.Image Img =
                System.Drawing.Image.FromFile(Server.MapPath("~\\UserPhoto\\") + ImageName))
                {
                    Size ThumbNailSize = NewImageSize(Img.Height, Img.Width, 150);

                    using (System.Drawing.Image ImgThnail =
                        new Bitmap(Img, ThumbNailSize.Width, ThumbNailSize.Height))
                    {
                        ImgThnail.Save(ThumbnailPath, Img.RawFormat);
                        ImgThnail.Dispose();
                    }
                    Img.Dispose();

//The below line is to delete the original image after thumbnail creation.
                    File.Delete(Server.MapPath("~\\UserPhoto\\") + ImageName);
                }            
            }
        }
        catch (Exception ex)
        {
            CommonFunctions.SendExceptionMessage(ex.StackTrace);
        }

The below function is to decide the Size of the thumbnail image.

  public Size NewImageSize(int OriginalHeight, int OriginalWidth, double FormatSize)
    {
        Size NewSize;
        double tempval;

        if (OriginalHeight > FormatSize && OriginalWidth > FormatSize)
        {
            if (OriginalHeight > OriginalWidth)
                tempval = FormatSize / Convert.ToDouble(OriginalHeight);
            else
                tempval = FormatSize / Convert.ToDouble(OriginalWidth);

            NewSize = new Size(Convert.ToInt32(tempval * OriginalWidth), Convert.ToInt32(tempval * OriginalHeight));
        }
        else
            NewSize = new Size(OriginalWidth, OriginalHeight); return NewSize;
    }

You can also check my last article on Validation controls in Asp.net.

Friday, July 27, 2012

DataAccess with ADO.Net in Asp.Net

- No comments
Introduction:
In this article we will discuss how to interact with Database from Asp.Net application. Here we will use Stored procedure and Ado.Net classes provided by Asp.Net. You can also use Microsoft Enterprise Library to interact with database from Asp.Net web site.

Description:
Before going forward you can also check Dataset and Datareader asp.net.
In the first step, Put the connection string in the web.config like below:

<connectionStrings>
 <add name ="DBConnection" connectionString="Data Source=Name of Datasource;Initial Catalog=Name of Database;User ID =UserID;Password=Password"/>
</connectionStrings>

The above connection string is valid if you are using SQL Server authentication. But if you are using windows authentication then the connection string will be like below:
<add name="DBConnection"  connectionString="Server=MyServer;Database=Name of Database;Trusted_Connection=Yes;"/>

or

<add name="DBConnection" connectionString="Initial Catalog=Name of Database;Data Source=Name of Datasource;Integrated Security=SSPI;"/>

Now we will write the stored procude will will take 2 parameter and insert data to the table. CREATE PROCEDURE [dbo].[Insert_UserMaster]
@FirstName varchar(150),
@LastName varchar(150)
AS
BEGIN
INSERT INTO UserMaster (FirstName,LastName)

VALUES (@FirstName,@LastName)
END

In the next we will write some using statement like below:

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

We can use ConfigurationManager class to retrieve connection string from web.config file.

string connection = ConfigurationManager.ConnectionStrings["DBConnection"].ConnectionString;

SqlConnection dataConnection = new SqlConnection();
try
{
dataConnection.ConnectionString = connection;
                dataConnection.Open();
                SqlCommand command = new SqlCommand("Insert_UserMaster", dataConnection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@FirstName", "Value of First Name"));
                command.Parameters.Add(new SqlParameter("@LastName ", "Value of Last Name"));

                int result = command.ExecuteNonQuery();
// Here ExecuteNonQuery() will return number of rows affected.
}
 catch (SqlException ex)
            {
                if (ex.Number == 2627)
                {
//This number is for Primary key exception. This exception will occur if you will insert multiple values to primary key column.
                }
            }
catch (Exception ex)
{
}
 finally
            {
                if (dataConnection != null)
                {
                    dataConnection.Close();
                }
            }
-----------------------------------------------------------------------
command.CommandType = CommandType.StoredProcedure;

If you want to write inline sql statements then the line will change to below:

command.CommandType = CommandType.Text;

You can also check one article on ExecuteScalar(),ExecuteNonquery(),ExecuteReader() in Asp.Net

Tuesday, July 10, 2012

Urgent opening for Dot Net Professional

- No comments
About Company:
Name: HG Technologies Ltd
Client Name: Undisclosed

Job Details:
Position : Dot Net Framework -Lead
Experience : 3.5-5 yrs
Job Location : Bangalore

Asp.Net with WCF Openings with Mid level company

- No comments
About comany:A mid level company.

Job Description:
Work Location - Bangalore
Experience - 3-5 Yrs
Required skills - Asp.Net, C#,WCF

Urgent opening for Dot Net Professional in US based Company

- No comments
About Company:
Name: CriterionSoft India Pvt. Ltd
Client Name: Undisclosed

Job Details:
We are looking for .NET developers to work with our CMM level 3 development partners at Bangalore.
Experience : 2- 4 Years

ASP.NET Module Lead Openings in CMMi 5 Company

- No comments
Company Details:Name: Mindtree ( CMMi 5 Comapny ). More information about the company here. http://www.mindtree.com/about-us

Job Description:

Experience- 3.5 to 5 Years
Competency-Module Lead
* Lead with experience of handling a team of 4 - 5
* Good design, programming and debugging skills

Saturday, July 7, 2012

global.asax file in Asp.Net

- No comments
Introduction:
In this article we will discuss what is global.asax file and what is the use of global.asax in Asp.Net application. Also you can check my last article on Web.config and Machine.config in asp.net.

Details:
- Global.asax file is useful to write global event handlers. Global.asax file executes its code automatically in response to some global events.

Friday, July 6, 2012

Solution Explorer in Visual Studio in Asp.Net

- No comments
In this article we will discuss what is a solution explorer in Visual Studio 2010. Here are few point about Solution explorer.

- You can view files inside the web application directory.

- Files that can be exists are likely .aspx files, .ascx, .asmx, .svc, web.config, images files, css file, .cs files, global.asax files etc.

- By right click on the solution explorer you can add new files, in the same way by chosing the particular file you can rename or delete the file.

Dot Net (WCF) walkin Capgemini Bangalore

- No comments
Looking for .Net, WCF, for Capgemini Bangalore. Candidates should have overall 3+ years of experience. Looking for candidates who can join in 15-30 days
Skills Required: 3+ years of strong experience in .Net, WCF.
While sending your resume please fill up the following format and send back.
--------------------------------------------------------
Number of months of Overall experience:
Number of months of experience in .Net:
Number of months of experience in WCF:

Wednesday, July 4, 2012

Why Asp.Net is popular ?

- 1 comment
In this blog we will see why Asp.Net is very much popular even when it released first. After Asp.Net released most of the professionals wanted to use Asp.Net to develop websites or windows applications. Thats why Asp.net is one of the most popular web development platform.

Few reasons of popularity of Asp.Net:

1. ASP.NET Is Integrated with the .NET Framework:
Asp.Net is integrated with the .Net framework, So Asp.Net application can use the namespaces
provided by .Net framework. There are thousands of namespaces and each namespaces contains different class which we can use in web applications as well as desktop applications also.

2. ASP.NET Is Compiled, Not Interpreted:
Asp.net applications are complied not interpreted, so that ASP.NET applications don’t need to be compiled every time a web page is requested. The IL code is created once and regenerated only when the source is modified.
 
3. ASP.NET Is Multilanguage:
Asp.Net supports multiple languages apart from popular C#.Net and VB.Net languages like J#.Net.

4. ASP.NET uses benifit of Common Language Runtime:
Asp.Net uses the benifit of Common Language Runtime (CLR) which has lots of benifits like:
- Automatic memory management and garbage collection.
- Type safety
- Extensible metadata
- Structured error handling
- Multithreading

5. ASP.NET Is Object-Oriented:
Since Asp.net is object oriented, so we can take the benifit of OOPS. You can create reusable classes, interfaces and you can use them in muliple places.

6. ASP.NET Supports all Browsers:
Asp.Net supports almost all the popular browsers apart from Internet explorer. It supports XHTML, CSS or JavaScript in all the browsers.

7. ASP.NET Is Easy to Deploy and Configure:
As the popularity increses from older versions to newer version, deployment becomes easy. Configuration becomes more easy, because most of the Asp.Net settings are stored in web.config file.

As Refered in Apress Pro Asp.Net 4 book.