Page 1 of 1

How to set value to asp:textbox, added to the form as HTML?

Posted: 26 Nov 2014
by Дмитрий Фоломеев
How to set value to asp:textbox (not sharepoint field), added to the form as HTML?


For example, I added asp:TextBox (as HTML) to form:

<asp:TextBox runat="server" id="TextBox100" ></asp:TextBox>


I want to set the field value, and do other changes using javascript:

fd.field('TextBox100').value('100');- not work

document.getElementById('TextBox100').value= "100"; - not work


please help.

Re: How to set value to asp:textbox, added to the form as HTML?

Posted: 27 Nov 2014
by Dmitry Kozlov
Hi Dmitry,

You can assign a CSS class to the textbox:

<asp:TextBox runat="server" id="TextBox100" CssClass="my-textbox" ></asp:TextBox>

And use it in your JS-code following way:

Code: Select all

$('.my-textbox').val()

Re: How to set value to asp:textbox, added to the form as HTML?

Posted: 27 Nov 2014
by Дмитрий Фоломеев
Thank you, it works!