• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1645
  • Last Modified:

get the value of a <input type="text" field in code behind

I have a simple

<input id="P0" type=text />

and a simple

<a href='javascript:markProp(1234)'>Click Here</a>

and the markProp function is

function marpProp(ListNum) {
    document.getElementById('P0').innerText = ListNum;
}

When the user presses the href = it changes the value of the inputfield with a dynamic value from a repeater control - and that works good - BUT ... i can't get that value in the codebehind.

I've tried Dim P0 As System.Web.UI.HtmlControls.HtmlInputText -

I just need to get the value of this field in the code behind.

Any ideas?

Thanks,

Gp.





0
timbersnow
Asked:
timbersnow
  • 2
  • 2
1 Solution
 
RedKelvinCommented:
try using
<input id="P0" type=text runat="Server" />

The runat="Server", should make it available in the codebehind, so then you should be able to access it directly using the "id"

eg
dim sTest as string = PO.Text
0
 
timbersnowAuthor Commented:
Never mind ... i figured it out.

In the page_load of the code behind, i put:

  P0.Attributes.Add("readonly", "readonly")

and wella ... it works.

Can i give mySELF points?  grin

Gp.
0
 
timbersnowAuthor Commented:
Hey Red ... i'll give you the points just cause you respoinded.

Easy ... eh?

BTW ... i had already tried that and it was no go ... i'm using the Telerik RAD:AJAXMANAGER which further complicates stuff.

Cheers,

Gp.
0
 
RedKelvinCommented:
ah, good work, glad you got it sorted, and thanks for the points ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now