Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all :)

I have a problem, when I try to insert new item from grid view to my table

I got this problem

how can I fix it ? :\

http://msasoftware.net/Hamza/Pics/Programmingproblems/porblem9878658645.png[^]

can you help me please
Posted
Comments
Ali Al Omairi(Abu AlHassan) 24-Sep-11 11:11am    
Please send the markups of your grid.

1 solution

Make sure none of the below is null and you've fixed the error.
0) insertItem
1) insertItem["User_Name"]
2) insertItem["User_Name"].FindControl("User_Name02")
3) insertItem["User_Name"].FindControl("User_Name02") as RadTextBox

note 3) is null if the result from 2) is null or not a RadTextBox. and it doesn't make much sense that you use as, as you do not check for null, you should explicitly cast instead.

Time to start debugging or provide more details as Ali requests. I suggest you debug this yourself, as a null reference exception is the most simple and common exception poeple encounter and the most easy to fix.
 
Share this answer
 
Comments
RaisKazi 24-Sep-11 11:19am    
My 5!
Simon Bang Terkildsen 24-Sep-11 11:32am    
Thank you, RaisKazi
Ali Al Omairi(Abu AlHassan) 24-Sep-11 11:42am    
Complete Answer, 5+.
But why Beginning from zero(its not an array).
Simon Bang Terkildsen 24-Sep-11 11:48am    
There is no rule saying a numbered list can't be zero-based :)
Thank you for your vote.
Sergey Alexandrovich Kryukov 25-Sep-11 3:45am    
All correct, my 5.
--SA

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