Web User Controls - How to reference objects on them?

H

Hanover

What I want to do seems like it should be simple:

1. Create a new web control

2. Place a datagrid on it and set it's ID to dgFiles

3. Assign it's datasource.

Sub ShowFiles()

Dim ds as dataset

....code here...

dgFiles.DataSource = ds

End Sub

When I assign it's datasource, it is saying dgFiles is not set to
anything which is stupid since intellisense is acting like it's there
and ready to be used.

So how do I reference to a control on my Web User Control?
 
J

john_teague

Are you trying to set is datasource on the aspx page that has the
control? If so, make the datagrid a public member of the control
instead of protected.
 
G

Guest

are you doing this in the control or the page containing the control?
From the controls codebehind you should easily be able to do it, from the
page you will have to do some extra work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top