title: How to use a Variable or Function to declare my SqlDataSource ID in HTML
body: <p>I'm writing a for loop that displays a list of links with some chartfx display. The chartfx needs an sqlDataSource. I'm trying to give the unique ID each time the for loop does one iteration but I can not pass it a value or function. Example below in my code.
  getSQLID() is just a function that returns a string which I want to be my ID. This is all done on the aspx page and the function is in the .cs . Any help would be really appreciated thank you.</p>
  
  <pre><code>     //name of the contentplace holder on the aspx page
      &lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server" &gt;
  
      //code behind
      Control ctrl = LoadControl("WebUserControl.ascx");
      Control placeHolderControl = this.FindControl("Content2");
      Control placeHolderControl2 = this.FindControl("ContentPlaceHolder1");
  
      ctrl.ID = "something";
      if (placeHolderControl != null)
          placeHolderControl.Controls.Add(ctrl);
      if (placeHolderControl2 != null)
          placeHolderControl2.Controls.Add(ctrl);
  </code></pre>