troubleshooting Question

webusercontrol - Unable to set value of the property 'value': object is null or undefined

Avatar of johnkainn
johnkainn asked on
JavaScript
4 Comments1 Solution765 ViewsLast Modified:
Hello,
If I have this in web user control (.ascx) I get an error but when it is in aspx page then there is no error. Do you know why that is?
 <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">
            function buildArgument(sender, args) {
                var t = "K";
                document.getElementById("argument").value = t;
            }
        </script>
    </telerik:RadScriptBlock>
          <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:HiddenField ID="argument" runat="server" />
    <asp:Button ID="SelectButton" runat="server" Text="Select" Width="100px" OnClick="SelectButton_Click"
                OnClientClick="buildArgument(this, event);" />


Microsoft JScript runtime error: Unable to set value of the property 'value': object is null or undefined
In the debugger this gets highlighted:
document.getElementById("argument").value = t;
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros