Pages

Saturday, February 11, 2012

CompiledQuery Linq to SQL C#

using CompiledQuery Linq to SQL C# using CompiledQuery can do more good performance and more efficient.
 using System.Data.Linq;
 public static Func> userData
        = CompiledQuery.Compile((myDataContext db) => db.TableUsers);

Using StopWatch to Count Execution Time in ASP.NET

Using Stopwatch to Count Execution Time in ASP.NET

 using System.Diagnostics;
 Stopwatch sw = new Stopwatch(); //create object
 sw.Start(); // start the stopwatch
 //do something here
 sw.Stop(); // stop the stopwatch
 Console.WriteLine("Time elapsed : " + sw.ElapsedMilliseconds.ToString());

Thursday, February 9, 2012

Make calendar events on ASP.NET

Make calendar events on ASP.NET

  • Drag Calendar Control to Your WebForm
  • Choose Event Menu
  • Find DayRender
  • Double Click

//Here's the codes
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
    List dt = new List();
    for (int i = 0; i < 5; i++)
    {
        DateTime myevent = new DateTime(2012,02,2+2*i);
        dt.Add(myevent);
    }

    foreach (var item in dt)
    {
        if (e.Day.Date == item)
        {
            e.Cell.ForeColor = Color.White;
            e.Cell.BackColor = Color.BlueViolet;
            e.Cell.Text = e.Day.DayNumberText;
            e.Cell.ToolTip = "tooltip untuk tgl " + e.Day.DayNumberText;
        }
    }
}

ShareThis