Question: I have a repeater that creates n-number of panels. I am trying to dynamically add different controls to each of the panels. I may very well be going about this the wrong way.

My code is more or less:

.aspx:

```
   <asp:Repeater ID="Repeater1" runat="server">
    <ItemTemplate>
        <% Response.Write("<asp:panel runat=\"server\" id=\"uxPanel_"); %>
        <%# DataBinder.Eval(Container.DataItem, "TableId")%><% Response.Write("\"></asp:panel>"); %>

    </ItemTemplate>
</asp:Repeater>

```

.cs:

```
public partial class class1: System.Web.UI.Page
{
  DataSet ds= null;
protected void Page_Load(object sender, EventArgs e)
{
    GetRecords(1,1);
}

protected void GetRecords()
{
    ds= dal.LoadRecords();

    this.Repeater1.DataSource = ds.Tables[0];
    this.Repeater1.DataBind();

    Literal lit = new Literal();
    lit.Text = "Some text";
    this.FindControl("uxPanel_1").Controls.Add(lit);        

}

```

}

Just to be clear in this example "dal.LoadRecords" is simply call to a method that retrieves some records from a DB. 

I think my problem is how I am adding my panels in the first place, but this seemed like an easy way to have them uniquely named.

Any Pointers? 

Thanks

Answer: 
**@Seth Hoenig**'s answer helped me best, but I just wanted to add that Go accepts functions with defined return value as well:

```
package main

func main() {
    m := map[string]func(string) string{
        "foo": func(s string) string { return s + "nurf" },
    }

    m["foo"]("baz") // "baznurf"
}

```

If you think it's ugly, you could always use a type (see **@smagch**'s answer).
Here is the way I made it work in my case:

```golang
package main

import (
    "fmt"
)

var routes map[string]func() string

func main() {
    routes = map[string]func() string{
        "GET /":      homePage,
        "GET /about": aboutPage,
    }

    fmt.Println("GET /", pageContent("GET /"))
    fmt.Println("GET /about", pageContent("GET /about"))
    fmt.Println("GET /unknown", pageContent("GET /unknown"))
    // Output:
    // GET / Home page
    // GET /about About page
    // GET /unknown 404: Page Not Found
}

func pageContent(route string) string {
    page, ok := routes[route]
    if ok {
        return page()
    } else {
        return notFoundPage()
    }
}

func homePage() string {
    return "Home page"
}

func aboutPage() string {
    return "About page"
}

func notFoundPage() string {
    return "404: Page Not Found"
}

```

<https://play.golang.org/p/8_g6Di1OKZS>