Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
C#
ucPostList.FindControl("ucOpinion1")
Posted

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
 
Share this answer
 
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900