Click here to Skip to main content
15,887,361 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an update panel that exists on my Default.aspx page. When I try to access it from the Default.aspx.cs page it is saying that it is NULL and gets caught by the try catch. Below is the code from both pages. Any help identifying why it is NULL would be appreciated. This is code that I am trying to debug from a contractor that I can no longer speak with. Thanks.

Default.aspx Code
<asp:updatepanel runat="server" updatemode="Conditional" id="UpdPanel">

Default.aspx.cs Code
ScriptManager.RegisterClientScriptBlock(UpdPanel, typeof(UpdatePanel), UpdPanel.ClientID, strReturn1, false);

What I have tried:

As shown above this is the code that is giving the issue.

Default.aspx Code
<asp:updatepanel runat="server" updatemode="Conditional" id="UpdPanel">

Default.aspx.cs Code
ScriptManager.RegisterClientScriptBlock(UpdPanel, typeof(UpdatePanel), UpdPanel.ClientID, strReturn1, false);
Posted
Comments
Richard Deeming 11-Mar-22 3:06am    
There's not enough information in your question for anyone to help you. For a start, you'll need to show the method that contains the line of code with the error, and explain when it is called.
Member 12690322 16-Mar-22 15:01pm    
I’m not sure if this is going to help but here is a more detailed answer with more code. There is a timer on the page that calls a method called GenerateEventAwardDetailsCall. This method uses a StringBuilder to create the marquee shown below.

sb.Append("<marquee behavior="SCROLL" height="25" width="600">"
+ dr["Field6b"].ToString() + " "
+ strMarquee1
+ dr["Field3a"].ToString() + " - "
+ dr["Field4a"].ToString() + "..."
+ strMarquee2
+ dr["Field5a"].ToString() + " - "
+ dr["Field6a"].ToString() + "...."
+ dr["Field6b"].ToString() + "
" + GetEventStatus(EventID, UserID) + "");

The method GetEventStatus contains this code and this is where the NULL message for the UpdatePnael is occurring.
if (!Page.IsPostBack)
{
strReturn += "";
strReturn1 += "";

strReturn2 += "$('#cdown').countdown(\"" + GenerateEventTimeDetails2(EventID, UserID) + "\")";
strReturn2 += ".on('update.countdown', function(event) {";
strReturn2 += "var format = '%-D days %-H hours %-M minutes %-S seconds';";
strReturn2 += "$(this).html(event.strftime(format));";
strReturn2 += "})";
strReturn2 += ".on('finish.countdown', function(event)";
strReturn2 += "{";
strReturn2 += "$(this).html('Please Wait, Refreshing ...')";
strReturn2 += ".parent().addClass('disabled');";
strReturn2 += "});";

strReturn1 += "";
strReturn1 += "";
strReturn1 += "";
ScriptManager.RegisterClientScriptBlock(UpdPanel, typeof(UpdatePanel), UpdPanel.ClientID, strReturn1, false);
ScriptManager.RegisterStartupScript(UpdPanel, typeof(UpdatePanel), UpdPanel.ClientID, strReturn2, true);
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900