Home > DeveloperSection > Forums > Adding multiple user controls in table
Ankit Singh

Total Post:341

Points:2389
Posted on    August-21-2014 12:32 AM

 ASP.Net ASP.Net 
Ratings:


 1 Reply(s)
 568  View(s)
Rate this:

I'm trying to put multiple user controls on the dashboard. But only one user control is visible.

Dashboard.aspx:

<table cellpadding="0" cellspacing="0" border="0" width="220px">

<tr>

<td>

<dc:MyControl ID="c1" runat="server"/>

</td>

<td>

<dc:MyControl ID="c2" runat="server"/>

</td>

</tr>

</table>

It looked like the global object created in user control overwrites the other one.

I then changed my javascript code as:

MyControl.ascx:

//Display gauge on the page (has some html5 elements like canvas)

<div id="gauge1" class="gauge"></div>

<script type="text/javascript">

var <%=this.ClientID%>global = new jGauge(); // Create a new gauge.

<%=this.ClientID%>global.id = 'gauge1'; // Link the new gauge to the placeholder DIV.

// This function is called by jQuery once the page has finished loading.

$(document).ready(function () {

<%=this.ClientID%>global.init(); // Put the gauge on the page by initializing it.

});

</script>

But still only one user control is visible. Any suggestions?



Sumit Kesarwani

Total Post:378

Points:2694
Supported
Posted on    August-21-2014 1:10 AM

Hi Ankit, 
try this:

<table cellpadding="0" cellspacing="0" border="0" width="100%">

    <tr>

        <td style="width:50%;">

            <dc:MyControl ID="c1" runat="server"/>

        </td>

        <td style="width:50%;">

            <dc:MyControl ID="c2" runat="server"/>

        </td>

    </tr>


Don't want to miss updates? Please click the below button!

Follow MindStick