Server Error in '/' Application.

Conversion from type 'DBNull' to type 'String' is not valid.

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.InvalidCastException: Conversion from type 'DBNull' to type 'String' is not valid.

Source Error:


Line 113:                    If c = 0 Then
Line 114:                        If dtpartydetail.Rows(c).Item("imgidlogo") > 0 Then
Line 115:                            imgurl = getstaticimg(dtpartydetail.Rows(c).Item("imgidlogo"), 50, dtpartydetail.Rows(c).Item("partyname"), dtpartydetail.Rows(c).Item("crop"), "tumb")
Line 116:                            'Me.Ltldetail.Text &= "<div class='col-lg-12 text-center'><img  class='img-circle' src='/imggrab.aspx?id=" & dtpartydetail.Rows(c).Item("imgidlogo") & "&w=200&m=tumb&l=n&c=1'/></a></div><div class='col-lg-12'>"
Line 117:                            Me.Ltldetail.Text &= "<div class='col-lg-12 text-center'><img  class='img-circle' src='" & imgurl & "'/></a></div><div class='col-lg-12'>"

Source File: C:\inetpub\vhosts\beta.sxmelections.com\news.aspx.vb    Line: 115

Stack Trace:


[InvalidCastException: Conversion from type 'DBNull' to type 'String' is not valid.]
   Microsoft.VisualBasic.CompilerServices.Conversions.ToString(Object Value) +1287685
   news.Page_Load(Object sender, EventArgs e) in C:\inetpub\vhosts\beta.sxmelections.com\news.aspx.vb:115
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3770.0