Click here to Skip to main content
12,352,739 members (65,918 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET Data-Binding
Hello dear all.

i have a user control in asp.net which is called ucPostList and it contains a Asp.net DataList control . in my DataList control i have another user control which is called ucOpinion. both two control retrive data from database and fill their source controls. now if i want to fill ucPostList by call their method ucOpinion control doesn't fill their source control .
how i can call internal control method ?
i want to call ucOpinion control method in ucPostList control . but i can not find any ucOpinion by
ucPostList.FindControl("ucOpinion1")
Posted 11-Mar-12 1:58am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

I hope ajit has given the solution for your problem. If you still want to improve or looking for another solution its here- http://www.blog.dapfor.com/data-binding
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi ,

First Register The User Control By Adding This Code On aspx Page :

<%@ Register Src="~/WebUserControls/ucPostList.ascx" TagName="ucPostList" TagPrefix="ucPostList" %>

Secondly Create a Object in Cs Page and find the Control :

ucPostList objPostList;
objPostList= (ucPostList)this.Page.FindControl("ucPostList");


After Creating the Object you can Call any functions Or Methods from your User Control.
objPostList.myFunction()


Hope This May Help You.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 28 Mar 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100