Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET Getting and Setting a datalist in UserControl

Status
Not open for further replies.

Caradog

Programmer
Jun 28, 2000
73
0
0
GB
Guys, I got a bit of problem. I've done this before but for the life of me I can't find the code.

I have a usercontrol which populates a datalist of names. This is done once on pageload.

On the aspx/vb which includes this usercontrol (which has already rendered the datalist of names), I need to reset the values in the datalist with new ones.

How do I expose the datalist from the usercontrol on the page its included on?
 
by providing a function in ur user control that will rebind the data???

Known is handfull, Unknown is worldfull
 
Sure so long as I can pass a var to it. WHat I have tried is creating a public sub in hte usercontrol to just display some text as a test. Then on the calling page referenced the control like so:

Private WithEvents ucMyControl as MyControl

Then I have tried to initate the function in the usecontrol by passing
ucMyControl.mySubName()

But all I get back is "object reference not set" error.
 
>>Private WithEvents ucMyControl as MyControl

that cannot be done to an ASCX control (Not if u r using Code Behind)! u have to use LoadControl() function at runtime and load it...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top