Search This Blog

Nov 6, 2012

ITIL V3 Foundation Certification

Recently I obtained the ITIL V3 Certification Foundation, So happy about it.

Jan 25, 2012

Partial Page Updates with ASP.NET AJAX

The feature most visible of AJAX ASP.Net is the ability to do a partial or incremental page updates without doing a complete postback to the server.

Advantages:
  • The state of your multimedia (such as Adobe Flash or Windows Media) is unchanged.
  • bandwidth costs are reduced.
  • Customer does not experience the flicker usually associated with a postback.


Dec 19, 2011

Sending email from ASP.Net 4 - C#

Below is sample code showing how to send email from ASP.Net 4 (currently in beta as of this posting) using C#. With this code I am assuming that the server already has a local SMTP service installed, so I use "localhost" to relay the email.
Here is the SendMail.aspx page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SendMail.aspx.cs" Inherits="SendMail" %>
 
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>
head>
<body>
    <form id="form1" runat="server">
    <div>
        Message to:
        <asp:TextBox ID="txtTo" runat="server">asp:TextBox>
        <br />
        Message from:
        <asp:TextBox ID="txtFrom" runat="server">asp:TextBox>
        <br />
        Subject:
        <asp:TextBox ID="txtSubject" runat="server">asp:TextBox>
        <br />
        Message Body:
        <br />
        <asp:TextBox ID="txtBody" runat="server" Height="171px" TextMode="MultiLine"
            Width="270px">asp:TextBox>
        <br />
        <asp:Button ID="Btn_SendMail" runat="server" onclick="Btn_SendMail_Click"
            Text="Send Email" />
        <br />
        <br />
        <asp:Label ID="Label1" runat="server" Text="Label">asp:Label>
    div>
    form>
body>
html>
Here is the source code of the SendMail.aspx.cs page:
using System;
using System.Web.UI.WebControls;
using System.Net.Mail;
public partial class SendMail : System.Web.UI.Page
{
    protected void Btn_SendMail_Click(object sender, EventArgs e)
    {
        MailMessage mailObj = new MailMessage(
            txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text);
        SmtpClient SMTPServer = new SmtpClient("localhost");
        try
        {
           SMTPServer.Send(mailObj);
        }
            catch (Exception ex)
        {
            Label1.Text = ex.ToString();
        }
    }
}

Nov 14, 2011

LINQ AND THE ADO.NET ENTITY FRAMEWORK


 

Practical Tips
  • Spend Time playing around with the anonymous types, looking at the different options that the intelligence list gives you.
  • It is a good practice to try to filter data as much as possible, try to incorporate the Where clause.
  • Make use of anonymoues type to decrease memory comsumption of your LINQ queries.
LINQ is a exciting Technology that ships with .NET 4 is an important techhique in many data-access scenarios including database access in ASP.NET web applications using EF(Entity Framework).
LINQ is so important an it has been integrated in many different places in .NET

 Additionally, LINQ is available for XML, Entities, ADO.NET and Data Sets, each tipy providing access to a different data source.

Nov 4, 2011

Practical Tips for Updating and Displaying Data

  • Always store your connection in Web.config
  • Consider Add validation controls to your data entries.
  • If you have long lists of data to present, always consider turning paging on  for controls like GridView.
  • Consider renaming your controls in the page to something other than their default values.
What is the different between BoundField and TemplateField?
A BoundField is directly tied to a column in your data source and offers only limited ways to customize its apperance. The TemplateField on the other hand, gives you full control over the way the field is rendered.

Coming up: LINQ AND THE ADO.NET ENTITY FRAMEWORK.

Oct 31, 2011

Using SQL to work with Database Data



Database is often the heart of a web site you need to consider very carefully its design. This is because we will have many pages accesing to the database and it will be hard to make changes such as removing tables or renaming columns
Always consider the primary key for your table, In my case I prefer to give each table a column called Id.
Give always to your tables and columns logical names. Avoid characters such as spaces, underscores, and dashes. For example a name like EmployeeID is much easier to read than Employee_ID_3
Always create create relationships between tables when appropriate. With proper relationships you minimize the change of ending up with orphaned or incorrect data.

Don't use SELECT * to get all columns from a database. By suing SELECT * you may be selecting more columns that you actually need.
Remember this word CRUD for Create, Read, Update and Delete that are operations against the database.
Try to take advance of all the tools provided by VWD(Visual Web Developer) that enables you interact with the database. This tools can be: DatagridView, DetailsView, SqlDataSource and others.