http://www.genmymodel.com/
Thursday, June 20, 2013
Tuesday, June 18, 2013
Open source project: SignalR Mutiple chatroom by URL querystring
- Support multiple chatroom by Querystring
- Store messages into SQL Server
Source code:
https://github.com/messagecompass/SignalRchatroom
Demo site:
http://myevents.apphb.com
http://eventtalk.apphb.com/chat.aspx?event=My%20Event%20Generic&UserName=Guest773
- Store messages into SQL Server
Source code:
https://github.com/messagecompass/SignalRchatroom
Demo site:
http://myevents.apphb.com
http://eventtalk.apphb.com/chat.aspx?event=My%20Event%20Generic&UserName=Guest773
Monday, June 17, 2013
What is closure in Javascript by exmaple code?
var variable = "top-level";
function parentFunction() {
var variable = "local";
function childFunction() {
print(variable);
}
childFunction();
}
parentFunction();
Closure:
A Javascript function is defined inside another function, its local environment will be based on the local environment that surrounds it instead of the top-level environment.
Reference:
http://eloquentjavascript.net/chapter3.html
Friday, June 14, 2013
How to export html table into Excel file in ASP.MVC?
public ActionResult ExportToExcel(int id)
{
string sb = "html table tag in here";
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(sb.ToString());
return File(buffer, "application/vnd.ms-excel");
}
How to render a view into a string in ASP.NET MVC?
protected string RenderPartialViewToString(string viewName, object model)
{
if (string.IsNullOrEmpty(viewName))
viewName = ControllerContext.RouteData.GetRequiredString("action");
ViewData.Model = model;
using (StringWriter sw = new StringWriter())
{
ViewEngineResult viewResult = ViewEngines.Engines.FindPartialView(ControllerContext, viewName);
ViewContext viewContext = new ViewContext(ControllerContext, viewResult.View, ViewData, TempData, sw);
viewResult.View.Render(viewContext, sw);
return sw.GetStringBuilder().ToString();
}
}
Subscribe to:
Posts (Atom)