Q:

Confused on how to put a split string into a repeater from a db

So I'm taking a string from my db, splitting it, then wanting to put the split up pieces into a table within a repeater. 
I have other methods I use to pull the data, and display it, however it's mostly listbox's and such and I'm unhappy with that as a table would be better. 
            var query = from q in Session.CurrentContext.MENU
                    where q.CycNum == 24 && q.PerID == 3 && q.CatID == 12
                    select new
       {
          Item = q.ButDesc
       };
        rpt_menu.DataSource = query;
        rpt_menu.DataBind();

My string that's in the db is stored as "text|text|text|text", | separates what should be items in different tables, but this case it's just a long string stored as explained. (Item) is the name of the eval label in the repeater. 
Obviously doing 
            char[] Sep = { '|' };
        string[] data = Convert.ToString(query).Split(Sep);
        foreach (string x in data)
        {
            Item = x;
        }
            rpt_menu.DataSource = query;
        rpt_menu.DataBind();

wouldn't work, but it's the general idea what I'm needing to do, any tips would be helpful.

A:

You can use a GridView control inside the Repeater when the GridView is rendered in the HTML it anyway gets converted to an HTML <table>:
Code behind:
public partial class RepeaterExample : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!Page.IsPostBack)
        {
            var c1 = new ContextMenu { Title = "Context Menu 1", Items = "Menu1|Menu1|Menu1" };
            var c2 = new ContextMenu { Title = "Context Menu 2", Items = "Menu2|Menu2|Menu2" };
            rptMenu.DataSource = new List<ContextMenu> { c1, c2 };
            rptMenu.DataBind();
        }
    }

    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        ContextMenu item = e.Item.DataItem as ContextMenu;
        Label lblTitle = (Label)e.Item.FindControl("lblTitle");
        lblTitle.Text = item.Title;

        GridView gvItems = (GridView)e.Item.FindControl("gvItems");
        gvItems.DataSource = item.Items.Split('|');
        gvItems.DataBind();
    }
}

public class ContextMenu
{
    public string Title { get; set; }
    public string Items { get; set; }
}

.ASPX:
<asp:Repeater ID="rptMenu" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
    <ItemTemplate>
        <asp:Label ID="lblTitle" runat="server" Font-Size="Large" Font-Bold="true"></asp:Label>
        <asp:GridView ID="gvItems" runat="server"></asp:GridView>
        <hr />
    </ItemTemplate>
</asp:Repeater>

Copy the example above into a new .aspx page > understand how it works > apply to your solution.

