Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

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 DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesCreating User Relationship HelpCreating User Relationship Help
Previous
 
Next
New Post
10/4/2012 12:36 AM
 

Good point. Here is what I am working with. It is nothing fancy

using System;
using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Web.Script.Services;
using System.Web.Services;

using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Entities.Users.Social;
using DotNetNuke.Services.Social.Notifications;
using Telerik.Web.UI;
using Photojima_FacebookFriends;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using DotNetNuke.Entities.Users;

namespace Friends 
{

    partial class Friends : PortalModuleBase, IActionable  
    {

        FriendsLinqDataContext lqDataContext = new FriendsLinqDataContext();
        #region "Event Handlers"
        private List<string> listOfFriends = new List<string>();
        private List<UserInfo> FriendList = new List<UserInfo>();
        private int FriendId{get;set;}
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (IsPostBack && !Page.IsCallback)
            {
                if (lvFriends.Items.Count != 0)
                {
                    foreach (ListViewDataItem item in lvFriends.Items)
                    {
                        CheckBox cbAddFriend = item.FindControl("cbAddFriend") as CheckBox;
                        if (cbAddFriend != null)
                        {
                            if (cbAddFriend.Checked)
                            {
                             
                                HiddenField hfFriendId = item.FindControl("hfFriendId") as HiddenField;
                                FriendId = Convert.ToInt32(hfFriendId.Value);
                                UserInfo InitiatingUser = UserController.GetUserById(PortalSettings.PortalId, UserInfo.UserID);
                                UserInfo TargetUser = UserController.GetUserById(PortalSettings.PortalId, FriendId);
                                FriendList.Add(TargetUser);
                            }
                        }
                       
                    }
                    
                }
                List<testResult> getFriends = (from i in lqDataContext.test(base.UserId) select i).ToList();
                lvFriends.DataSource = getFriends;
                lvFriends.DataBind();
            }
           
        }


Thanks again for all the help

 
New Post
10/4/2012 1:02 AM
 
Ok this works for me.

Int32 thisFriendId = 97;

but if I apply the same to

Int32 thisFriendId = Convert.ToInt32(hfFriendId.Value);

it does not.
 
New Post
10/4/2012 1:54 AM
 
Ok so - what is in thisFriendId = after you do the convert on hfFriendId.

I dont see anywhere in your code that actually puts code into hfFriendId - what does hfFriendId.Value return. Is it the value you expected. In fact is it even finding this hfFriendId hidden field.

Also not sure what you are using to create this code - but if this is a properly setup aspx with codebehind - you should not need to look for the hidden field - it should be part of the page.

There does not seem to be any dynamic code in the sounce that is creating the hgFieldId - so i assume its part of the Friend.aspx layout - if so as a partial class you should be able to address it directly without any need to do a lookup.

Westa

 
New Post
10/4/2012 1:55 AM
 
Mark,

what is the value of hfFriend at this point? Are you sure the hidden field gets populated at this time?

Best wishes
Michael

Michael Tobisch
DNN★MVP

dnn-Connect.org - The most vibrant community around the DNN-platform
 
New Post
10/4/2012 2:16 AM
 

hfFriendID is a hidden field within the item template of a asp:ListView and its value is populated I actually can see that 

thisFriendId has a value in it when in debug

UserInfo TargetUser = UserController.GetUserById(PortalSettings.PortalId, thisFriendId);

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesCreating User Relationship HelpCreating User Relationship Help


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out