Friday, June 24, 2011

Invalid operation. The connection is closed. ASP.NET MVC

Invalid operation. The connection is closed. ASP.NET MVC

In Entity framework 4.0.. datacontext shouldn't be static. so then, in every controller, you need to do a new instance of datacontext.

Otherwise, static datacontext can occur that two different request hitting will break the site.

Globalization .net

foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.
DropDownListLang.Items.Add(new ListItem(ci.NativeName, ci.Name));

That's cool. You will get all available .net culture into the drop down list.

Wednesday, June 1, 2011

return confirm('" & strMessage & "');")

Most of people know the following codes.

btn.Attributes.Add("onclick", "return confirm('single " & strMessage & " single ');")

what I want to mention is "return confirm('" & strMessage & "')
sometime in development, you may need to do string manipulation. the similar case could be happened any time.

For reference purpose, I've hosted this post. If someone can reference on this, I am worth to put this post.