Monday, July 30, 2012

ASP.NET MVC 3: Async jQuery progress indicator for long running tasks

http://blog.janjonas.net/2012-01-02/asp_net-mvc_3-async-jquery-progress-indicator-long-running-tasks

  public ActionResult Start()
  {
    var taskId = Guid.NewGuid();
    tasks.Add(taskId, 0);
 
    Task.Factory.StartNew(() =>
    {
      for (var i = 0; i <= 100; i++)
      {
        tasks[taskId] = i; // update task progress
        Thread.Sleep(50); // simulate long running operation
      }
      tasks.Remove(taskId);
    });
 
    return Json(taskId);
  }

Friday, July 27, 2012

How to make A link to submit a form?

<form>
 <a href="#" onclick="parentNode.submit();">Submit</a>
</form>

How to add print button in a web page by Javascript?

 
<a href="javascript:window.print()">Print</a>
   

Thursday, July 26, 2012

How to display an image from memory in ASP.NET MVC3

In controller:
        public ActionResult MyImage()
        {
            byte[] image = .....;
            return File(image, "image/png");
        }

In view:
<img src="@Url.Action("MyImage", "ControllerName")" alt="my image" />



http://rayaspnet.blogspot.ca/2012/06/how-to-covert-string-to-image-in-mvc.html

The circles of marketing

4circlesofmarketing
http://sethgodin.typepad.com/seths_blog/2012/07/the-circles-of-marketing.html