New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the Community Exchange, where community members ask and answer questions about DNN. To get started, just start typing your question below and either select one of the suggested questions or ask a new question of your own.

Anybody else having an Issue with DnnUrlControl in 9.1.1

Return to previous page

  • 7/21/2017
  • 1225 Views

Question:

Joe Terhune 7 years ago

When trying to use the DnnUrlControl or old UrlControl in a custom module, I get the error below when setting the Url property

Message:Error rendering URLControl subcontrols.
StackTrace
InnerMessage:Object reference not set to an instance of an object.
InnerStackTrace: at DotNetNuke.UI.UserControls.UrlControl.DoChangeURL() at DotNetNuke.UI.UserControls.UrlControl.OnPreRender(EventArgs e)

ASCX File:

<portal:URL ID="dnnUrlCntr" runat="server" />

Code Behind:

protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!Page.IsPostBack)
{
var locCtl = new CountyController();

ddlCounty.DataSource = locCtl.GetCounties().OrderBy(c => c.CountyName);
ddlCounty.DataTextField = "CountyName";
ddlCounty.DataValueField = "CountyId";
ddlCounty.DataBind();
ddlCounty.Items.Insert(0, new System.Web.UI.WebControls.ListItem("< Select County >", ""));

var tc = new ProgramController();

if (ProgramId > 0)
{
var t = tc.GetProgram(ProgramId);
if (t != null)
{
txtProgramName.Text = t.ProgramName;
dnnUrlCntr.Url = t.Url;
}

var plp = tc.GetProgramCountyPhoneListItems(ProgramId);
rptLocatonList.DataSource = plp;
rptLocatonList.DataBind();
}
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}

Anybody else having an Issue with DnnUrlControl in 9.1.1

Joe Terhune
Joe Terhune 7 years ago
Add an Answer

Answers

Sign In to Participate
Or register to become a member