M# Tutorials

Learn to build .NET applications with M#. Our step-by-step tutorials will get you up-to-speed rapidly.
If you already know ASP.NET and C#, you can master M# in a week or two.

Property Setters

Property setters allow you to set a value of your new instance or change the value of an existing one.


By default when you select a property M# tries to get this property from the QueryString but you can change this with the help of several attributes.

Must set

This will enforce the value to be set.
The two following pictures show the result with a "False" and "True" value respectively set to the "Must set" attribute. If you enforce the property to be set and in our example there is no ".Date" parameter in the query string you will get an InvalidCastException because null cannot be converted to a date.

Query string key

This is the name of the query string parameters to get the value from.


This attribute allows you to specify a custom C# value like


for a DateTime property.


Allows you to specify a rule, for example


. If this rule is not met the property will not be set.


You can specify when the instance value is set in the page life cycle: Initialization, Load, PreRender, Before save.

Set in postback

If you set this to "True" the value will be set after each PostBack event.