/    Sign up×
Community /Pin to ProfileBookmark

Accessing values using Javascript in .net user control

Hello,

I need to access a asp.net textbox using javascript inside a user control. I am using javascript to display/collapse sublinks underneath a main link when the user clicks on the main link. I can easily display the sublinks but I need to keep state information inside a textbox (when user expands link I will put a value inside the textbox). Normally, I do something like this to find value inside a textbox:

<code>
document.Form1.txtFirstPage.value
</code>

However, with a .net user control there is no form. I think that I should be able to use something like this:

<code>
document.getElementById(“txtSomeTextBox”).style.value;
</code>

However, this does not work because this syntax is wrong. The main question I have is:
how do I access a textbox value inside a .net user control using JavaScript? Especially using the getElementById function if this is possible.

Also, if anyone has simple code on how to do what I’m doing (expand/collapse sublinks underneath a main link using JavaScript) I’d be thrilled to see it.

Thanks much,

Joe

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @dotnetcoder4u spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...