Click here to Skip to main content
15,918,041 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello, please help me in this very wierd problem I'm having!
I have a user control. it's composed out of 2 textbox and some labels and linkButton that fire onclientclick event.
I want the textbox to do some javascript validations. so I'm trying to get to the text-box element using javascript

document.getElementById('<%= txtID.ClientID %>') - this gets the element properly. The strange thing is - the value is always empty string! even when there IS text it might be because the usercontrol is inside an usercontrol that in side listview (ItemTemplate) with pager control in side update panel in side a page with master page ... anyone ever encountered this? any ideas?

thanks in advanced!
Posted
Updated 13-Jan-10 21:44pm
v2

I am guessing this means you have an order of operations problem. Try instead emitting your javascript from your code behind.
 
Share this answer
 
If you pass an html in the client, it will be independent of all these MasterPages, UserControl or Pager. In the client side everything is the same.

Inspect the control. If you have an <input type="text" rendered in the client side, it must find the document.getElementById("...").value properly.

Please let me know if you are looking on the right one. Just put a breakpoint, or add debugger; before the javascript line and check the outerHtml of this control to see what exactly the control is.

If it is a normal input control, there bound to be a Value property.

;)
 
Share this answer
 
my by my question dont was Clear

I got a usercontrol inside a listview (in the item-template ) which contains a button and a textbox inside. for some reason I can't reach the value of the textbox (which is inside the user control inside the listview)

why is that?

thanks!
 
Share this answer
 
please just confirm the textbox is readonly or not. If it is readonly then remove the property on designview & then apply the readonly property in codebehind. please let me know...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900