0

I dont undestand why, but my javascript doesnt work ... I've some textbox like these:

<asp:TextBox runat="server" Text='<%# Bind("SCAPULAIRE") %>' ID="txtScapulaire"/>

And i try to get the value of these textboxes. So i use javascript this way:

document.getElementById('<%=txtScapulaire.ClientID %>').value = 3;

But Visual studio tells me that "txtScapulaire is not declared". Maybe because of its protection. Do you have any idea why it isnt working ?

Thanks a lot !

4
  • Otherthan the VS warning, does the code works ? Commented Dec 26, 2015 at 3:45
  • It's not a warning, that's the problem ^^ Commented Dec 26, 2015 at 3:56
  • @user3272798 - The problem I think is,you have your textbox inside any databound control like Gridview or Repeater control. In that case it won't work like this. Commented Dec 26, 2015 at 7:25
  • Yes indeed, it is in a formview ... what can i do then ?? Commented Dec 26, 2015 at 7:26

1 Answer 1

1

I found it:

I've too do something liek that:

myformID.Findcontrol("txtscapulaire").ClientID

:D thanks

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.