title: The server tag is not well formed. html runat="server" and data-target="#<% Eval("Abbreviation")%>"
body: <p>I have to generate checkboxes, which i have to check when a button is clicked.
  When the checkbox is clicked it needs to use the "data-target" to uncollapse some code.</p>
  
  <p>I need both the collapse and getting if its checked.</p>
  
  <p>Problems:
  the runat="server" and data-targer="#&lt;%# Eval("Abbreviation")%>" gets my compiler saying "The server tag is not well formed".</p>
  
  <p>When i try to get the "chk.checked" on serveside it says it doesn't know it since i can't have runat="server" if i have the data-target.</p>
  
  <p>Here is the html code for the repeater.</p>
  
  <pre><code>&lt;asp:Repeater ID="ferryRepeater" runat="server"&gt;
              &lt;ItemTemplate&gt;
                  &lt;div id="div1" runat="server"&gt;
                      &lt;input  id="chkFerry"  type="checkbox" data-toggle="collapse" runat="server" data-target="#&lt;%# Eval("Abbreviation")%&gt;"  /&gt;
                      &lt;!--data-target="#&lt;%# Eval("Abbreviation")%&gt;" --&gt;
                      &lt;label id="label1" for="chk1"&gt;&lt;%# Eval("SubcontractorName") %&gt;&lt;/label&gt;
                      &lt;div id="&lt;%# Eval("Abbreviation") %&gt;" class="collapse obligatorisk"&gt;
                          &lt;dl&gt;
                              &lt;dt id="toFrom1"&gt;&lt;/dt&gt;
                              &lt;dd&gt;
                                  &lt;p id="text1"&gt;&lt;%# Eval("DialogueText") %&gt;&lt;/p&gt;
                              &lt;/dd&gt;
                          &lt;/dl&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>Here is the backend code for checking the checkboxes.</p>
  
  <pre><code>private List&lt;string&gt; CheckFerryCheckbox()
  {
      List&lt;string&gt; ferryList = new List&lt;string&gt;();
      foreach (RepeaterItem item in ferryRepeater.Items)
      {
          CheckBox chk = (CheckBox)item.FindControl("chkFerry");
          if (chk.Checked)
          {
              Label ferry = (Label)item.FindControl("label1");
              ferryList.Add(ferry.Text);
          }
      }
  
      return ferryList;
  }
  </code></pre>
  
  <p>Here is where i Binding with the repeater.</p>
  
  <pre><code>private void BindRepeaterData()
  {
      string sqlString = @"SELECT sc.SubcontractorName, dt.DialogueText, sc.Abbreviation FROM dbo.Subcontractor sc LEFT OUTER JOIN dbo.DialogueText dt ON sc.DialogueId = dt.DialogueId WHERE sc.Active = 1 AND sc.Type = 'Færge' ORDER BY sc.SubcontractorName";
      SqlCommand cmd = new SqlCommand(sqlString, conn);
      DataSet ds = new DataSet();
      SqlDataAdapter da = new SqlDataAdapter(cmd);
      da.Fill(ds);
      ferryRepeater.DataSource = ds;
      ferryRepeater.DataBind();
  }
  </code></pre>
  
  <p>I have tried to change Data-target to data-target='#&lt;%# Eval("Abbreviation")%>' and have runat="server", but then it doesn't generate the Eval.</p>
  
  <p>Sorry if this is not that well explained. It is my first post here, so please be gentle.</p>