How To Access One UserControl from Another Using ASP.NET
<p>I have created a user control <code>UserVote</code> that has property to find total vote on particular question.</p>

<p>Now I want to call it from an aspx page.</p>

<p>The control code-behind (<code>UserVote.ascx.cs</code>) looks like:</p>

<pre><code>public partial class UserVote : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dtVoteInfo = ShowVoteDetail(objectType, objectId);
        if (dtVoteInfo != null)
        {
            if (dtVoteInfo.Rows.Count &gt; 0)
            {
                int.TryParse(dtVoteInfo.Rows[0]["TOTAL_VOTE"].ToString(), out currentVote);
                int.TryParse(dtVoteInfo.Rows[0]["MY_VOTING"].ToString(), out myVoting);
            }
        }
        ltrVotes.Text = currentVote.ToString();
        hfCurrentVote.Value = currentVote.ToString();
        hfMyVote.Value = myVoting.ToString();

        // ...snipped for brevity...
    }
}
</code></pre>

<p>The control markup (<code>UserVote.ascx</code>) looks like:</p>

<pre><code>&lt;div class="vote-cell" style="width: 46px; height: 92px"&gt;
  &lt;img src ="~/UserControls/Vote/Images/Arrow Up.png" 
        id = "voteupoff" 
        runat = "server" alt ="vote up" 
        class="voteupImage" 
        style="height: 45px; width: 45px"/&gt;
  &lt;div class="vote" style ="text-align:center; color:#808185;font-weight:bold;"&gt;
    &lt;asp:Literal ID="ltrVotes" runat="server" &gt;&lt;/asp:Literal&gt;
  &lt;/div&gt;
  &lt;img  src ="~/UserControls/Vote/Images/arrow_down.png" 
        id ="votedownoff" 
        runat = "server" alt = "vote down"
        class = "votedownImage" 
        style="height: 45px; width: 44px; margin-left: 0px;" /&gt;
&lt;/div&gt;
</code></pre>

<p>My page code-behind (<code>viewanswer.aspx.cs</code>) looks like:</p>

<pre><code>UserVote Voteing = (UserVote) **what i write here...**.findcontrol(voting)
Voteing.objectType =300;
Voteing.object id= 2;
</code></pre>

<p>My page markup (<code>viewanswer.aspx</code>) looks like:</p>

<pre><code>&lt;klmsuc:Voteing ID="Voteing" runat="server" /&gt;
</code></pre>
