Click here to Skip to main content
13,502,077 members
Rate this:
Please Sign up or sign in to vote.
See more:
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??
pranathis012 20-Dec-12 1:11am
no yar it's not possible to debug in my project that's the reason i ask in this site. why bcz that is pre built there no option to debug my code at any case
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.
pranathis012 20-Dec-12 1:36am
we can't debug directly we just copy the source code and .aspx file in to my developer server directly we check on there it self . we can't check on put a break point and see each and every line it's not possible in my company.
and one more thing i don't write any thing in my link button that is empty.
Christian Graus 20-Dec-12 1:37am
There is clearly different source on your dev server. Your company is retarded. Run for your life.
pranathis012 20-Dec-12 1:41am
we can't do any thing for this but i want to submit my reports that's my job now..
so what i'm asking is what are the reason's to get this type of error's previously i'm getting this error in some different case and i can easily over come at that time but in my linkbutton click event is empty then also it's showing that error why...?
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.
pranathis012 20-Dec-12 2:06am
k thank u i will check out my page load event again i face any problem means i will contact you with your permission
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 |
Web04 | 2.8.180417.1 | Last Updated 20 Dec 2012
Copyright © CodeProject, 1999-2018
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