By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,784 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Reference control in user control

P: n/a
I need a better way to reference a control using javascript from inside a
user control. I need the suer control to know about the name of the user
control vaiable upon use.

i.e. document.getElementById("my_discussionPanel_imgExp and").src = ...

The above does work fine if the class that uses the user control call it
my_discussionPanel (imgExpand is a control inise the suer control)

The problem is that this is not very general since the name of the user
control variable could be different.

i.e. a class defines

Dim your_newDiscussionPanel as DiscussionPanel


the declaracion in the user control

document.getElementById("my_discussionPanel_imgExp and").src

will not be valid

Is there any other way to do this???


Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a

I never did that, however I think using the "properties", property and than
the Id or something can do what you want (I am now not sure what is used
already in the viewstate, so have a look yourself)

In this sample I add a piece of JavaScript, however AFAIK you can use any
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Me.Button1.Text = "Send Mail"
Me.Button1.Attributes("onClick") =
"window.location='mailto:no* or demo&body=I hope this
End If
End Sub
I hope this helps?

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.