Click here to Skip to main content
11,934,809 members (48,620 online)
Rate this:
Please Sign up or sign in to vote.
See more: SQL-server-2005 C# ASP.NET , +
hi am getting error in this line..can anyone tell me wat type of error that i can solve this..?am using dynamic in my project.
protected void Page_Init(object sender, EventArgs e)
      objDyn.GenerateTabControls("FM_FactoryMaster", out dynDiv, out gListDynamicControls, true, false, false);
Posted 14-May-12 23:59pm
Edited 15-May-12 1:49am
Wes Aday104.2K
sjelen 15-May-12 12:37pm
objDyn is probably null. What is it? A control? Some custom class? Where do you initialize it?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Take a look here[^]
VJ Reddy 16-May-12 10:43am
Useful reference for common questions. 5!
losmac 16-May-12 10:56am
Thank you, VJ ;)
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

This error happens when you try to use a property or call a method of an object that is null. More details: here[^]

A simple use of Visual studio DEBUGGER can tell you the object because of which it is happening. Just look at the stack trace and put a debugger on that line. Check the objects of that line and see if any one is null and you are trying to use that objects property. Handle the same.

Above, looks like objDyn is NULL or one of the parameters passed assuming error is not raised in GenerateTabControls method.
ythisbug 15-May-12 5:29am
gListDynamicControls this value is showing 0..
ythisbug 15-May-12 5:31am
and in objDyna dt=null and dr also null..wat it wat changes have to do??u have any idea..
Sandeep Mewara 15-May-12 11:50am
What do you mean by 'coming null', have not these implemented/defined/written by you?

As Bernhard said, out params can be null. Step through and check the line where it bombs. Use F11.
Technoses 15-May-12 12:08pm
write it on page_load event
ythisbug 15-May-12 5:38am
hi sandeep
dynDiv is coming null.i put breakpoint and checkd..
Bernhard Hiller 15-May-12 8:48am
C'mon, those are the OUT parameters - they can be null when you call the function. In case you get the error really exactly in the line shown, objDyn is null. Where is that instatiated?
But I am not sure if you have checked that the error was not raised in GenerateTabControls function...
Sandeep Mewara 15-May-12 11:33am
Thanks for correcting me. Yes, only objDyn looks potential culprit. (Assuming error is not raised in the method!)
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

write this code on page_load in place page_init

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
Web03 | 2.8.151126.1 | Last Updated 15 May 2012
Copyright © CodeProject, 1999-2015
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