I wanted to use css file to my visual WebPart. Developing it in VS2012. Initially worked fine without .css after deployment. After following steps here, updated the
.wsp. It is also working fine. But when I am going to add same Web Part on another page it showing error as
Object reference not set to an instance of an object
In Code there is no null reference occurring while debugging.What should be the issue?
Edited: After digging it out it is found that in debug mode (by attaching w3 processes), when I Edit page in Sharepoint site it hits the
protected override void OnInit(EventArgs e)
Event of webpart and surprisingly it is making Page.Ispostback = true hence it is directly entering to the else part of condition.
And in this else part I am checked the value for drop down selected item. suddenly there is no values in drop down and returning null reference.Well I can change the logic here. But wondering why its making IsPostback as True in OnInit Event itself by hitting the Edit Page in Sharepoint site?