Jan 5 2006

Microsoft VPC 2004

Category:Bil@l @ 23:56

Hello:

I just finished now configuring my laptop to function as follows:

My laptop is a toshiba Satellite M45 Series. The host operating system is Windows XP + SP2.

I have created a Virtual PC with the guest operating system as Windows 2003 Standard Server and installed on it most of the development tools I use, including:

Visual Studio 2003 + Visual Studio 2005 + MS SqlServer 2000 + FireWorks MX 2004 + IE 6.0 + FireFox 1.0 + MS Front Page 2003

Then I backed-up the new VPC which is around 7GB to an external HardDisk.

I will now format my host machine and have a clean installation of WinXP SP2.

This way, whatever happened to my guest machine, the basic tools which usually takes like 6 or 7 hours to be installed will be preserved now.

You can also, create a VPC with any windows installation and keep that VPC as a Base HardDisk, then I can create other VPCs out of that Base HardDisk by inheriting from the base one.

Hope this post helps you out.

Regards.

Tags:

Jan 4 2006

Code Snippets in Visual Studio 2005

Category: ASP.NET 2.0 - GeneralBil@l @ 17:09

I kindly invite you to check my latest article on the www.aspalliance.com, with the title of:

Code Snippets in Visual Studio 2005

Hope you enjoy it.

Regards

Tags:

Jan 3 2006

www.System.Net.Mail

Category: General | GeneralBil@l @ 17:55

My colleague Dave Wanta published his new informative website about System.Net.Mail, the new namspace for email-related issues in ASP.NET 2.0

check at: http://www.systemnetmail.com/

Regards

Tags: ,

Aug 30 2005

Identity Columns in MS SQL Server

Category: Databases & SQLBil@l @ 10:17

When working with Identity Columns in MS SQL Server, and specially when testing your database and inserting some junk data for the sake of testing, you ask yourself, how would I reset my Identity Columns to their original values after I finish testing with the junk data?

dbcc checkident (Table1, reseed, 1)

Hope that helps.

Regards

Tags:

Jul 15 2005

Define an Event Handler for a HyperLink Server Control

Category: ASP.NET 1.x | ASP.NET 2.0 - GeneralBil@l @ 06:55

Hello, a common question on the ASP.NET Forum is:

How to define an Event Handler for a HyperLink?

The solution as follows:

protected System.Web.UI.WebControls.HyperLink HyperLink1;
    
private void Page_Load(object sender, System.EventArgs e)
{
    HyperLink1.Attributes.Add("onClick",
Page.GetPostBackEventReference(this.HyperLink1,"HyperLinkPostBack$"+this.HyperLink1.ID)); if ( (IsPostBack) && (Request.Form["__EVENTTARGET"] != null) && (Request.Form["__EVENTARGUMENT"].ToString().StartsWith("HyperLinkPostBack")) ) { string[] args = Request.Form["__EVENTARGUMENT"].ToString().Split('$'); if ( (string.Compare(args[0], "HyperLinkPostBack", false, System.Globalization.CultureInfo.InvariantCulture) == 0)
&& (args.Length > 1) ) { HyperLinkHandler(args[1].ToString()); } } } public void HyperLinkHandler(string ID) { Response.Write("You clicked HyperLink with ID : "+ ID); }

                
 

                
 
 Or You could use this way, using IPostBackEventHandler:

                
private void Page_Load(object sender, System.EventArgs e)
{
    HyperLink1.Attributes.Add("onClick", Page.GetPostBackEventReference(this, "HyperLinkPostBack" + "$" + this.HyperLink1.ID));
}

public void RaisePostBackEvent(string eventArgument)
{
    if (!string.IsNullOrEmpty(eventArgument))
        {
            string[] args = eventArgument.Split('$');
                if ((string.Compare(args[0], "HyperLinkPostBack", false, System.Globalization.CultureInfo.InvariantCulture) == 0) 
&& (args.Length > 1)) { HyperLinkHandler(args[1].ToString()); } } } public void HyperLinkHandler(string ID) { Response.Write("You clicked HyperLink with ID : " + ID); }

                
 

Hope that helps,

Regards

Tags: ,

Jul 14 2005

Add JavaScript Functionality to GridView

Category: ASP.NET 2.0 - GeneralBil@l @ 19:58

If you want to change the Cursor when the mouse is over the GridView, follow the simple steps below:

protected void RowCreated (object sender, GridViewRowEventArgs e)
{
    e.Row.Attributes.Add("onMouseOver", "this.style.cursor='n-resize'");
}


Hope that helps,

Regards

Tags:

Jul 14 2005

Extend GridView

Category: ASP.NET 2.0 - GeneralBil@l @ 19:43

I want ot point you to two important links on Extending GridView, by Frerik Normen:

1- http://fredrik.nsquared2.com/print.aspx?PostID=186

2- http://fredrik.nsquared2.com/print.aspx?PostID=177

Hope that helps,

Regards

Tags:

Jul 13 2005

TemplateField in GridView

Category: ASP.NET 2.0 - GeneralBil@l @ 23:43

You can call a custom method inside the TemplateField of the GridView as follows:

<TemplateField>
  <ItemTemplate>
      <%# GetSum((int)Eval(“Number1“), (int)Eval(“Number2“)) %>
  </ItemTemplate>
</TemplateField>

public string GetSum(int num1, int num2)
{
     return (num1+num2).ToString();
}

Hope that helps,

Regards

Tags:

Jul 13 2005

DateTime Methods

Category: ASP.NET 1.x | ASP.NET 2.0 - GeneralBil@l @ 23:01

I had today to work with some DateTime calculations.

I need two methods:

1- Get time difference between two dates, in such a way to have the following formats in the returned value:

- Hours
- Minutes (01 -> 1 minute, 10 -> 10 minutes,...)
- Seconds
- Hours.Minutes
- Hours:Minutes:Seconds

2- Add a double value for a DateTime

- double value (7.02 -> 7 hours and 2 minutes, 7.10/7.1 -> 7 hours and 10 minutes)
- DateTime value

Check the methods below:


// partType :