Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello all,
I have the following code which is returning an error as below:
Cannot perform runtime binding on a null reference
Does anyone have any ideas why this would be happening? - Using Umbraco 6
var queryStringId = Request.QueryString["id"];
if(queryStringId != null )
{
@Model.feedbackText
}
else
@Model.contactUsText
Kindest regards,
J
Hi James
Perhaps it's the way you're doing your test.
Try testing like this instead
if(!String.IsNullOrEmpty(querystringId.ToString())){ // Your code here }
Hope this helps.
/Jan
Thanks for your response. This hasn't worked either:
string queryStringId = Request.QueryString["id"];
if (String.IsNullOrEmpty(queryStringId))
What happens if you cast the querystringId to a string, like I did in my example? Just to make sure that the value can't be interpreted as anything else than a string when you're validating it.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Cannot perform runtime binding on a null reference
Hello all,
I have the following code which is returning an error as below:
Cannot perform runtime binding on a null reference
Does anyone have any ideas why this would be happening? - Using Umbraco 6
var queryStringId = Request.QueryString["id"];
if(queryStringId != null )
{
@Model.feedbackText
}
else
{
@Model.contactUsText
}
Kindest regards,
J
Hi James
Perhaps it's the way you're doing your test.
Try testing like this instead
Hope this helps.
/Jan
Thanks for your response. This hasn't worked either:
string queryStringId = Request.QueryString["id"];
if (String.IsNullOrEmpty(queryStringId))
{
@Model.contactUsText
}
else
{
@Model.feedbackText
}
Hi James
What happens if you cast the querystringId to a string, like I did in my example? Just to make sure that the value can't be interpreted as anything else than a string when you're validating it.
/Jan
is working on a reply...