Click here to Skip to main content
15,662,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I m working on a project. I am receiving a JavaScript runtime error. The Error is:
Microsoft JScript runtime error: Sys.ArgumentNullException: Value cannot be null.<br />
Parameter name: element

Please help me solve this error.
Thank you.
Updated 21-Apr-11 21:31pm
Monjurul Habib 22-Apr-11 3:02am    
question is not clear.share your code.

This is a very common exception in the Microsoft Ajax Library, and just means you've got something named wrong or you are missing a parameter. Sometimes you might just have the wrong element id set somewhere as a parameter, and this will throw the exception.

You'll need to post your code so we can see if there are any errors in your markup. The exception message itself is so generic it doesn't really tell us alot about what is going on.
Share this answer
SURBHI TYAGI 22-Apr-11 4:47am    
<cc1:TabPanel runat="server" HeaderText="TabPanel2" ID="TabPanel2">
<HeaderTemplate>User Management

<asp:GridView ID="GridView1" runat="server"
style="top: 230px; left: 447px; position: absolute; height: 164px; width: 251px" AutoGenerateColumns="false" DataKeyNames="id" DataSourceID="SqlDataSource1">
<asp:BoundField DataField="id" HeaderText="ID" InsertVisible="False"
ReadOnly="True" SortExpression="id" />
<asp:TemplateField HeaderText="User Name" SortExpression="username">
<itemstyle verticalalign="Top" width="155px">
<asp:LinkButton ID="LinkButton1" CommandName="CommandName" CommandArgument='<%# Bind("username") %>' runat="server" Text='<%# Bind("username")%>'>
<cc1:ModalPopupExtender ID="ModalPopup1" runat="server" CancelControlID="Button1" PopupControlID="Panel1" TargetControlID="LinkButton1">

<asp:BoundField DataField="password" HeaderText="Password" SortExpression="job" />
<asp:BoundField DataField="confirmpassword" HeaderText="Confirm Password" SortExpression="confirmpassword" />
<asp:BoundField DataField="phonenumber" HeaderText="Phone Number" SortExpression="phonenumber" />
<asp:BoundField DataField="prsnrole" HeaderText="Role" SortExpression="prsnrole" />
<asp:BoundField DataField="gender" HeaderText="Gender" SortExpression="gender" />
<asp:BoundField DataField="dob" HeaderText="DOB" SortExpression="dob" />

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:abc %>" SelectCommand="select * from [adminuser] where prsnrole='user'">

sir my code is this which i have written above.i m doing this in tab container and before this my code is working perfect but as i do this my code is giving error...
i.e;Microsoft JScript runtime error: Sys.ArgumentNullException: Value cannot be null.
Parameter name: element

Sir please tell me what should i do to remove this error and my code can work perfectly.

Thank you.
[no name] 22-Apr-11 6:12am    
Is given Error message is complete. can you give line of code where Exception gets
Value of some of your element is null. You need to debug your code to find out which element value is null.

Better do a null check before doing any operation with the elements value.
Share this answer
it is looking like you are missing a parameter or may be the IDs of the controls (which you are using) is changing on run time, thats why these controls are not available on run time.
Share this answer
Microsoft JScript runtime error: Sys.ArgumentNullException: Value cannot be null.
Parameter name: element

The above statement says that in your code there is element(variable) which load with null value.

You can do one thing try to put your each and every variable in " Alert(); " and see what you are getting like this,

Suppose i have on evariable called, var example="This is an Example".

It will give you output as "This is an Example."

I hope it will help you.
Share this answer
Set ScriptMode="Release" of your ScriptManager.

<asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release">
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