Click here to Skip to main content
12,458,160 members (53,901 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET C#4.0
Hi ,

this is my source code

<asp:LinkButton ID="btninsert" runat="server" onclick="btninsert_Click">
                Insert Data</asp:LinkButton>

this is my code behind

protected void btninsert_Click(object sender, EventArgs e)

when i click on insert link button i'm getting the error "object reference not set to an instance of an object ". As per my knowledge this error causes when there is no data whatever we pass the parameters and when there is no data in a datatable in that cases i'm facing this type of problems in previously.

But i'm simplly calling the insert click event there is no data in that , why it's showing this error can any one tell me the reasons to get this error.

and help me how to overcome this issue now...

Thanks in Advance.....
Posted 19-Dec-12 19:07pm
Updated 19-Dec-12 22:53pm
AshishChaudha 20-Dec-12 1:09am
have you tried to debug your code??
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If it's not possible to debug, you also can't change the code, so there's no point asking here. How do you know what the code behind is, if you can't debug ? Clearly it's not what you posted, you can't get an error without running code.
Christian Graus 20-Dec-12 1:37am
There is clearly different source on your dev server. Your company is retarded. Run for your life.
Christian Graus 20-Dec-12 2:03am
It's not empty, unless the error is being thrown by page load or page prerender. Either way, we can't tell you the reason, based on what you posted.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I think, there is no error in button click event. please debug in page load.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Debug your code, most probably there is something written it your code which is not getting the proper value or its null.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 20 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100