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: 
I used a **map[string]func (a type, b \*type)** I passed a string to search the map and a pointer to modify the slice.

Hope that helps!

```
var Exceptions map[string]func(step string, item *structs.Item)

func SetExceptions() {
    Exceptions = map[string]func(a string, i *structs.Item){
        "step1": step1,
    }
}

func RunExceptions(state string, item *structs.Item) {
    method, methBool := Exceptions[state]
    if methBool {
        method(state, item)
    }
}

func step1(step string, item *structs.Item) {
    item.Title = "Modified"
}

```
Hope this works for you(you can use interface{} instead any)

```
package main

import (

    "fmt"

)

func toon(v any) {

    fmt.Println(v)

}

func main() {

    names := map[string]any{

        "Function": toon,

    }

    names["Function"].(func(any))("a")

}

```