Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i fix the "JavaScript Runtime Error: Couldn't set Value property of Reference that undefined or null" error?
or why its happen?


when i click the delete button i got this error.

i share my code:

ASP.NET
<asp:GridView ID="gvSepet" runat="server" CellPadding="4" DataKeyNames="sepetID" CssClass="table cart" GridLines="None" AutoGenerateColumns="False" ShowFooter="false" OnRowDeleting="gvSepet_RowDeleting">
                            <AlternatingRowStyle BackColor="White" />
                            <Columns>
                                <asp:CommandField ShowDeleteButton="True" ItemStyle-CssClass="cart-product-remove" ButtonType="Image" DeleteImageUrl="images/icon-trash2.png">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:CommandField>
                                <asp:ImageField DataImageUrlField="resimyolu1" ItemStyle-CssClass="cart-product-thumbnail"></asp:ImageField>
                                <asp:BoundField DataField="urunad" HeaderText="Ürün Adı" ItemStyle-CssClass="cart-product-name" />
                                <asp:BoundField DataField="fiyat" HeaderText="Fiyat" ItemStyle-CssClass="cart-product-price">
                                    <ItemStyle HorizontalAlign="Right" />
                                </asp:BoundField>
                                <asp:BoundField DataField="adet" HeaderText="Adet" ItemStyle-CssClass="cart-product-quantity">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="tutar" HeaderText="Tutar" ItemStyle-CssClass="cart-product-subtotal">
                                    <ItemStyle HorizontalAlign="Right" />
                                </asp:BoundField>

                            </Columns>
                            <EmptyDataTemplate>
                                <h3>Sepetinizde ürün bulunmamaktadır.</h3>
                            </EmptyDataTemplate>
                        </asp:GridView>


C#
protected void gvSepet_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            DataTable dt = (DataTable)Session["sepet"];
            dt.Rows.RemoveAt(e.RowIndex);
            Session["sepet"] = dt;
            SepetGoster(dt);
        }


What I have tried:

i cant doing anything for this error
Posted
Updated 27-Apr-16 23:14pm
Comments
Nigam,Ashish 28-Apr-16 4:53am    
please check is session "sepet" is available or not.
Member 10525430 28-Apr-16 4:57am    
its available
Sergey Alexandrovich Kryukov 28-Apr-16 12:53pm    
In what line?
—SA

1 solution

Quote:
JavaScript Runtime Error: Couldn't set Value property of Reference that undefined or null
The message means that for some reason the variable do not contain the expected object.
Use the debugger to see exactly what is wrong.
I think you will have to add code to check if the variable is not NULL.
 
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