10 weber Posted February 19, 2011 Share Posted February 19, 2011 I wrote in a web masterpage <div style="display:inline-block; background-image:url(Images/star.svg); width:<%=((int)Session["adminLevel"] * 31) %>px; height:30px;"></div><div style="display:inline-block; background-image:url(Images/emptyStar.svg); width:<%=(93 - (int)Session["adminLevel"] * 31) %>px; height:30px;"></div> to show users their adminLevel parameter. It's supposed to show a bar of 3 stars, some of which are full and the other empty. To do that I wrote Server Error in '/' Application.Object reference not set to an instance of an object.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error:Line 25: %>Line 26: <br />Line 27: <div style="display:inline-block; background-image:url(Images/star.svg); width:<%=((int)Session["adminLevel"] * 31) %>px; height:30px;"></div>Line 28: <div style="display:inline-block; background-image:url(Images/emptyStar.svg); width:<%=(93 - (int)Session["adminLevel"] * 31) %>px; height:30px;"></div>Line 29: </td>Source File: c:\Users\ADMIN\Documents\Visual Studio 2010\Projects\web\web\Site.Master Line: 27Stack Trace:[NullReferenceException: Object reference not set to an instance of an object.] ASP.site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\Users\ADMIN\Documents\Visual Studio 2010\Projects\web\web\Site.Master:27 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8 System.Web.UI.Control.Render(HtmlTextWriter writer) +10 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8 System.Web.UI.Page.Render(HtmlTextWriter writer) +29 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.