Welcome to the Community Exchange

Welcome to the Community Exchange, a place where community members can exchange questions and answers related to DotNetNuke. If you would like more info about the Community Exchange, please visit this page in our Wiki. 

Member Directory and KnockOut Tokens

Hi

I am trying to use MemberId as a Knockout token and am getting an JavaScript error saying that MemberId binding is not defined.

I am using it like this

data-bind="attr: { title: MemberId}

Also I was hoping someone could explain some knockout syntax for me. With the HTML module token replacement I can produce the following string

http://mysite.com/profile?userid=1
by doing this http://mysite.com/profile?userid=[Users:UserId]

How can I do this with knockout? I the usage examples I have seen, knockout is binding to attributes. I have yet to see an example of concatenation. 

Thanks for the help

Mark

asked 8/10/2012
Mark Hollas80
Mark Hollas

2 Answers

This answer has been selected by the question author as the best answer.

Since the forum cut off my code, let's see if the exchange handles it better 

Mark, You would need to use the UserId attribute.

If you wanted to add it to a span you could do it like

<span data-bind="text: UserId"></span>

answered 8/13/2012 Chris Hammond 657
Chris Hammond

I suggest to inspect the ViewModel behind using javascript developer tools like firebug (or the tools build into the browsers available through F12).   

answered 8/12/2012 Stefan Cullmann 161
Stefan Cullmann
  • The answer to this was to use UserId. I guess in my attempts previous I was using userId (note the case) and it was not working which got me on the path to MemberId. - Mark Hollas 8/13/2012

  • I have done that and I do see that there is self.UserId = ko.observable(item.MemberId) in memberdirecroty.js so I don't quite understand why I can not use the binding. - Mark Hollas 8/12/2012

Your Answer

In order to provide an answer to this question, you must Login

I am flagging this question because...




10 inform moderator flags remaining

I am deleting this question because...




I am flagging this answer because...




10 inform moderator flags remaining

Flagging a Post

You have already flagged this post. Clicking "Remove Flag" below will remove your flag, thus reducing the count by one as well.

I am deleting this answer because...




DotNetNuke Corporation

DotNetNuke (DNN) provides a suite of solutions that make designing, building and managing feature-rich sites and communities fast, easy and cost-effective. The DotNetNuke Platform CMS is the foundation for more than one million websites worldwide. DNN Social, our newest solution, enables businesses to create immersive, interactive communities. Thousands of organizations like True Value Hardware, Bose, Cornell University, Glacier Water, Dannon, Delphi, USAA, NASCAR, Northern Health and the City of Denver have leveraged DNN to deploy highly engaging business- critical websites. Our rapid growth in product sales and deployments resulted in DotNetNuke Corp. being named one of the fastest growing private companies in America by Inc. Magazine in 2011 and 2012.