Note that there are some explanatory texts on larger screens.

plurals
  1. POBinding dictionary to Accordion panes
    primarykey
    data
    text
    <p>I have an Accordion control with several panes.</p> <p>On page load I want to set controls inside the panes with data from dictionary (every pane has from 1 to 10 controls).</p> <hr> <p>ASPX</p> <pre><code>&lt;cc1:Accordion ID="Accordion1" runat="server" FadeTransitions="True" SelectedIndex="0" HeaderCssClass="accordionHeader" ContentCssClass="accordionContent" Width="370px"&gt; &lt;Panes&gt; &lt;cc1:AccordionPane ID="AccordionPane1" runat="server"&gt; &lt;Header&gt; some text &lt;/Header&gt; &lt;Content&gt; &lt;asp:Label ID="lblTitle" runat="server" Text='&lt;%# Eval("key1")%&gt;'&gt;&lt;/asp:Label&gt;&lt;/li&gt; &lt;/Content&gt; &lt;/cc1:AccordionPane&gt; &lt;cc1:AccordionPane ID="AccordionPane2" runat="server"&gt; &lt;Header&gt; some text &lt;/Header&gt; &lt;Content&gt; &lt;asp:Label ID="lblTitle" runat="server" Text='&lt;%# Eval("key2")%&gt;'&gt;&lt;/asp:Label&gt;&lt;/li&gt; &lt;/Content&gt; &lt;/cc2:AccordionPane&gt; &lt;/Panes&gt; &lt;/cc1:Accordion&gt; </code></pre> <hr> <p>C#</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { Dictionary&lt;string, string&gt; dic = new Dictionary&lt;string, string&gt;(); dic.Add("key1", "XXXXXXXXXX"); dic.Add("key2", "YYYYYYYYYY"); Accordion1.DataSource = dic; Accordion1.DataBind(); } </code></pre> <p><strong>Update:</strong> </p> <p>This is an example of a dictioanry that I want to bind to accordion:</p> <pre><code> var dic = new Dictionary&lt;string, IEnumerable&lt;object&gt;&gt;(); dic.Add("Item1", new List&lt;object&gt;() //This to Pane 1 { new { SNumber = 12345 }, new { Color = "Blue" }, new { Size = "Large" }, }); dic.Add("Item2", new List&lt;object&gt;() //This to Pane 2 { new { SNumber = 1235678 }, new { type = "OM" } }); Accordion1.DataSource = dic; Accordion1.DataBind(); } </code></pre> <p>On aspx, I want to create Pane for every section (in this case 2 panes), and in every pane define Eval for needed value.</p> <p>p.s.<br> I don't think it metters but if dictionary binding is a problem I can bind something else like xmldocument or so...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload