Wednesday 20 July 2011

SQL: Get random records from database

Question:
How to get a number of random records from a table.

Monday 18 July 2011

Dot.Net: Register WebResource Javascript from Different Assembly

Question:
I have a web control project and a web project.
In the web control project I embed a javascript file and declared it as a WebResource in the AssemblyInfo.cs:
[assembly: System.Web.UI.WebResource("Namespace.Folder.MyScript.js", "text/javascript", PerformSubstitution = false)].

When I want to use it from the web project using:
this.Page.ClientScript.RegisterClientScriptResource(this.GetType(), "Namespace.Folder.MyScript.js");
It does not work.
Why is the javascript file not loaded into the page?

Dot.Net: Loading UserControl ascx Dynamically

Question:
How to load a UserControl (ascx) dynamically?

Dot.Net: Make Internal Methods and Properties visible to another DLL

Question:
How to make internals visible to another dll?
I want to render my internals visible to a test class. How do I do that?