Passing Parameters From Page (aspx) to WebControl (ascx) Where control exists in another project

When a WebControl exists in the same project as the related page you can easily pass params in the Control directive within the page. In the example below we want to pass the StateCode of KY:

<gcl:GreenPricingControl id="GreenPricingControl" runat="server" StateCode="KY"></gcl:GreenPricingControl>

If the WebControl exists outside of the project you must append the following to the page where the WebControl directive sits:

	protected override void OnLoad(EventArgs e) {
        GlobalUserControl2.SetProperty("StateCode", "KY");

And in your WebControl create a property for it to be available:

public string StateCode
        get {
            if (ViewState["StateCode"] == null) { ViewState["StateCode"] = ""; }
            return (string)ViewState["StateCode"];
        set { ViewState["StateCode"] = value; }

Excluding A Web Site From Building When Debugging (F5)

From Jared:

Inline code is great.

You can update any site by just pushing out one file with your code in it, and all references to that file are set. However, the downside is that the capability that allows you to do that (on-demand compiling) is the same thing that holds you back when debugging if you compile the site before debugging (which is the default).

Output Window

Even worse… debugging makes you compile every site, most of which aren’t even relevant to your test.

Luckily there’s an easy way around this.

1. Go to the property pages of your site (Solution Explorer > Right-click solution > Property Pages…).
2. On the “Build” tab, set the “Before running startup page” action to “No Build”

No Build

Do this for every web site in your solution except the one your localhost is set to. This should cut wait time down dramatically.

Formatting Code in WordPress

Wrap your code in these tags:

[sourcecode language=’css’]

your code here


Any of the following can be used for the language parameter (using one is required):

  • bash
  • cpp
  • csharp
  • css
  • delphi
  • html
  • java
  • jscript
  • php
  • python
  • ruby
  • shell
  • sql
  • vb
  • xml

Code in between the [sourcecode] tags will automatically be encoded for display, you don’t need to worry about HTML entities or anything.


string test;
class cls = new class;

string[] stringArray;

Good pattern for DIV Tables

Good pattern for div tables

/* divTable */
.divTable { position: relative; }
.divTable .row { position: relative; }
.divTable .row .c1 { position: absolute; top: 0px; }
.divTable .row .c2 { position: absolute; top: 0px; }
.divTable .row .c3 { position: absolute; top: 0px; }

/* change the divTable dimensions for different situations (always set .row height) */
.LShape .divTable { width: 682px; }
.LShape .divTable .row .c1 { left: 0px; width: 227px; }
.LShape .divTable .row .c2 { left: 227px; width: 227px; }
.LShape .divTable .row .c3 { left: 454px; width: 228px; }
.LShape .divTable .indented { padding: 0px 13px; }

Note:  c2 starts where c1 left off and c3 starts where c2 ends.