Re: object reference not set to an instance of an object

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ken Dopierala Jr. (kdopierala2_at_wi.rr.com)
Date: 12/02/04


Date: Thu, 2 Dec 2004 12:42:33 -0600

Hi,

Do you have the runat="server" tag in your btnEdit? Also, where and when
are you getting the error? Are you sure it happens on the
btnEdit.Attributes line? Also I would definitely switch your syntax to what
Kevin showed, that's how I've always done it. Try commenting out the
attributes line and do something else with the button. Like btnEdit.Visible
= True, if this gives you the same error then there is a problem with either
your button tag or your button declaration, if no error then we have
narrowed it down to how you are adding your attribute. Good luck! Ken.

-- 
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.
"louise raisbeck" <louiseraisbeck@discussions.microsoft.com> wrote in
message news:3728851E-41F0-4369-81A1-6181B8FFA60D@microsoft.com...
> yes i did actually try that syntax. same error message:
>
> System.NullReferenceException: Object reference not set to an instance of
an
> object
>
> "louise raisbeck" wrote:
>
> > hi there,
> >
> > I looked up posts on how to get a javascript confirm on the onclick of a
> > button to determine whether to run server code and i wrote this on the
page
> > load..
> >
> > string jsalert = "javascript:if(confirm ('Is the employee a rehire?') ==
> > false) return false";
> > btnEdit.Attributes["onclick"]=jsalert;
> >
> > however I'm getting the error message in my subject heading. what have i
> > done wrong? when i start to write it i get intellisense so i know it
> > recognises btnEdit.


Relevant Pages

  • Re: object reference not set to an instance of an object
    ... Well, Louise, you have 2 possibilities: ... What exactly IS "btnEdit?" ... Object reference not set to an instance of ... >> however I'm getting the error message in my subject heading. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
    ... you're calling sent back some ill-formed XML: Missing the end tag, ... exactly as the error message indicates. ... getServiceIdsReturn> ...
    (comp.lang.java.programmer)
  • Re: ASP.NET applications not working??
    ... The one thing I can think of to help you get the error message, ... setting the customErrors tag in the proper web.config file. ... a "web.config" configuration file located in the root directory of the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Wayne-In-Manchester
    ... Do you have a control on the subform named License Tag Number? ... And if the line fails, what error message do you get? ... The error message often points the problem. ...
    (microsoft.public.access.gettingstarted)
  • Re: org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
    ... calling sent back some ill-formed XML: Missing the end tag, ... as the error message indicates. ... getServiceIdsReturn> ...
    (comp.lang.java.programmer)