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

Posted on 2007-10-07
Last Modified: 2013-11-07
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?



Question by:timbersnow
    LVL 22

    Accepted Solution

    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"

    dim sTest as string = PO.Text

    Author Comment

    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


    Author Comment

    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.


    LVL 22

    Expert Comment

    ah, good work, glad you got it sorted, and thanks for the points ;-)

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now