Could somoen help:
I have an existing web page that I have recently added an Infragistics WebTab to. I have moved all my asp.net controls
to tab 1 of the webtab control. Everythings works fine, and I love the control other than I can no longer access a textbox
via javascript which is now contained within tab1 of the webtab control.
My javascript is contained within a linked JScript.js file. I used to be able to do the following.
document.getElementById('txtCustomer').value = 'This is some text'; But now I'm getting the following error
"Microsoft JScript runtime error: Unable to set value of the property 'value': object is null or undefined". I am guessing
it's because the control is now a child of the WebTab control
How do you access a child control of a Infragistics WebTab control via Javascript?
Any help would be appreaciated.
Thanks
Dave.
Please disregard this last post: I found that it the javascript has to be registered in the code behind in order to get the javascript to be unique to each instance of a UserControl. The issue had nothing to do with the WebTab.
Thanks for the help.
Question: That worked for controls directly on each tab. Now for an added level of complexity. What if you create a user control with embedded JavaScript that updates a textbox on the usercontrol. How do you get reference to each unique User Controls textbox, when an instance of the same UserControl is placed on different tabs?
ie: I have a User Control 'Criteria.ascx'. the control has javascript code that does the following.
document.getElementById('<%=txtCustomer.ClientID%>').value = 'Criteria Added';
Which is called when a user clicks a asp.net button on the UserControl. If I add this UserControl to multiple tabs and click the button on the first tab, the textbox on the second tab's UserControl get's updated!
Hello Dave,
When you place controls inside of the tab the ids will be changed dynamically to avoid conflicts if there are controls with the same name used on different tabs. The same thing happens for UserControls and ContentPlaceholders on a master page.
As such, the id being passed into document.getElementById will need to be modified. The best way to accomplish this is to use the ClientID of the server side control:
document.getElementById('<%= txtCustomer.ClientID %>')
I've attached a small sample that demonstrates how the ClientID is formed along with how to use the code block to access a control inside of a tab.
Please let me know if I can be of any further assistance.