| snaqeel@gmail.com 2006-09-20, 7:38 pm |
| Hi,
We have got our site built by a vendor sometime ago and now we are
encountering this error.
Its happens when we go to "Media Highlights" Section on our website and
whenever somebody wants to edit a posting it throw's this error.
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:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
WS.WCMS.Web.Admin.ManageMediaHighlights.ShowValuesFromTable(String
findGuid) +1025
WS.WCMS.Web.Admin.ManageMediaHighlights.Page_Load(Object sender,
EventArgs e) +593
System.Web.UI.Control.OnLoad(EventArgs e) +67
WS.WCMS.Web.Common.BasePage.OnLoad(EventArgs e) +73
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +772
========================================
=
Here's ShowValuesFromTable Proc
public void ShowValuesFromTable(string findGuid)
{
CmsApplicationContext context = base.AdminContext ;
Posting post = AdminContext.Searches.GetByGuid(findGuid) as
Posting;
txtMediaTitle.Text = post.DisplayName.ToString();
Template template = post.Template;
if(( post.Placeholders["Title"] as HtmlPlaceholder )!=null)
txtMediaTitle.Text = ( post.Placeholders["Title"] as
HtmlPlaceholder ).Text;
if(( post.Placeholders["Content"] as HtmlPlaceholder )!=null)
txtMediaContent.Html = (
post.Placeholders["Content"] as HtmlPlaceholder ).Text;
if(( post.Placeholders["MediaDate"] as HtmlPlaceholder )!=null)
calMediaDate.Date = Convert.ToDateTime(
(post.Placeholders["MediaDate"] as HtmlPlaceholder ).Text);
if(( post.Placeholders["Publisher"] as HtmlPlaceholder )!=null)
txtMediaPublisher.Text = (
post.Placeholders["Publisher"] as HtmlPlaceholder ).Text;
if(post.CustomProperties["ExtendFeatures"]!=null)
{
if(post.CustomProperties["ExtendFeatures"].Value==Checked.Yes.ToString())
{
chkExtendtoFeaturesYN.Checked=true;
}
}
if(post.CustomProperties["MediaNoticeContentYN"]!=null)
{
if(post.CustomProperties["MediaNoticeContentYN"].Value==Checked.Yes.ToString())
{
chkMediaContentyn.Checked=true;
}
}
string MediaUri=String.Empty;
string MediaFileURL = String.Empty ;
string VPImageURL=String.Empty;
string VPImg=String.Empty;
ResourceGallery rsg;
rsg = context.Searches.GetByPath("/Resources/WCMS/" +
base.GetCurrentCulture.ToUpper() + "/NewsAndEvents/Media
Highlights/Media/") as ResourceGallery;
if(post.CustomProperties["MediaUri"] != null )
{
MediaUri = post.CustomProperties["MediaUri"].Value ;
foreach (Resource rst in rsg.Resources )
{
if(MediaUri == rst.Name.ToString())
{
MediaFileURL = rst.Url ;
break;
}
}
FileURI.Visible = false ;
if(MediaUri != string.Empty )
{
ltlShowFileName.Text = "<a href='" + MediaFileURL + "'
class='HOME' Target='_Blank' >" + MediaUri + "</a>" ;
hdnMediaUri.Value = MediaUri ;
FileURI.Visible = false ;
lnkEdit.Text = base.LocalizeText("ltlEdit");
}
else
{
if(FileURI.Visible == false )
{
FileURI.Visible = true ;
if(MediaUri!=String.Empty)
{
lnkEdit.Text = LocalizeText("btnCancel");
}
ltlShowFileName.Visible = false ;
}
else
{
FileURI.Visible = false ;
lnkEdit.Text = LocalizeText("ltlEdit");
ltlShowFileName.Visible = true ;
}
}
if(post.CustomProperties["VPImage"] != null )
{
VPImg = post.CustomProperties["VPImage"].Value ;
rsg = context.Searches.GetByPath("/Resources/WCMS/" +
base.GetCurrentCulture.ToUpper() + "/NewsAndEvents/Media
Highlights/VPImage") as ResourceGallery;
foreach (Resource rst in rsg.Resources )
{
if(VPImg == rst.Name.ToString())
{
VPImageURL = rst.Url ;
break;
}
}
VPImage.Visible = false ;
if(VPImg != string.Empty )
{
ltlShowVPFileName.Text = "<a href='" + VPImageURL + "'
class='HOME' Target='_Blank' >" + VPImg + "</a>" ;
hdnVPImage.Value=VPImg;
VPImage.Visible = false ;
lnkEditVPImage.Text = base.LocalizeText("ltlEdit");
}
else
{
if(VPImage.Visible == false )
{
VPImage.Visible = true ;
if(VPImg != string.Empty )
{
lnkEditVPImage.Text = LocalizeText("btnCancel");
}
ltlShowVPFileName.Visible = false ;
}
else
{
VPImage.Visible = false ;
lnkEditVPImage.Text = LocalizeText("ltlEdit");
ltlShowVPFileName.Visible = true ;
}
}
}
}
}
========================================
==
As i don't have the direct access to database, so i downloaded SDO from
our production server and imported it into our Development server and
it worked fine here.
To my understanding the error is when this Sub is looping throught the
ResourceGalleries, can somebody help me how to find this problem on our
production server.
Thanks
Syed
|