Hi I keep getting this error message when inserting a variable instead of a harcoded number in new Member()
My code looks like this and actually returns two errors
var profileID = HttpContext.Current.Request.QueryString["profileID"]; if (profileID != null) { var member = new Member(profileID); } else { var member = new Member(currentMember); }
First of all the if sentence doesn't work - none of the conditions are run (tested with hardcoding the member numbers).
New Member (1200); works fine, but inserting profileID instead of a hardcoded number returns this error message:
The best overloaded method match for 'umbraco.cms.businesslogic.member.Member.Member(int)' has some invalid arguments
I guess there is something wrong with the profileID variable. What am I missing?
Ah, well you're declaring the new member inside the if/else. It's only usable in that scope. You probably want it to be more like this (untested):
Member member; var profileID =HttpContext.Current.Request.QueryString["profileID"]; if(profileID !=null){ member =newMember(profileID); }else{ member =newMember(currentMember); }
new Member () doesn't accept variable
Hi I keep getting this error message when inserting a variable instead of a harcoded number in new Member()
My code looks like this and actually returns two errors
First of all the if sentence doesn't work - none of the conditions are run (tested with hardcoding the member numbers).
New Member (1200); works fine, but inserting profileID instead of a hardcoded number returns this error message:
The best overloaded method match for 'umbraco.cms.businesslogic.member.Member.Member(int)' has some invalid arguments
I guess there is something wrong with the profileID variable. What am I missing?
You probably need to do int.Parse(profileID) as Request.QueryString returns a string.
Yes, converting profileID to an integer solved one of the issues. I used AsInt() instead, but you are right.
It didn't solve the problem with my if sentence. It seems like it isn't decalring the member variable in any case.
Ah, well you're declaring the new member inside the if/else. It's only usable in that scope. You probably want it to be more like this (untested):
You're brilliant - thanks that did it :o)
is working on a reply...