Products

Solutions

Resources

Partners

Community

About

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...SQL and SQL Ser...SQL and SQL Ser...DataBind Another TableDataBind Another Table
Previous
 
Next
New Post
3/16/2015 12:18 PM
 

Hello,

Still new to DNN but learning little by little. I have a basic understanding of how DataBind is used to store my modules data on my SQL Server. I have messed around with the single entry I have in the module's table aka presenting the AssignedUserId, CreatedOn, and LastModifiedByUserId ect just because I could. My question is how do I use DataBind to access another table on my server? For instance to access the dbo.Users table?

Another question: is there a simple way to query data from the linked database? Eventually I need to be able to pull data from another server. I've been reading articles and watching the videos but I can't really tell if I'm following what they're trying to accomplish and if it's the same thing I'm trying to do.

Thanks!

 
New Post
3/16/2015 12:49 PM
 
you shouldn't bind directly to the tables, but the objects in API - like userinfo, which gets loaded and updated via UserManager class.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
3/16/2015 1:26 PM
 

That makes sense I'm just unaware at the moment how to go about doing that. You can see the template generated code here:

If I'm reading this correctly it's creating a new controller, linking it to ModuleId (I'm not sure how it knows what that is [420]), then binding that data set.

On the view I think I understand that 'Container.DataItem' points to that module in my case my test module 'DNNModule2_Items' as it appears on my server then searches that table for an ItemId column and posts that to the module.

How does 'Container.DataItem' know that I only want to access rptItemList? Is there not a way to have multiple databinds in a single repeater? 

Sorry I'm just trying to get a basic concept of what I should do. I'm looking at this post here to see if maybe it can help.

Thanks again.

 
New Post
3/16/2015 1:41 PM
 
same would apply with usercontroller:
var uc = new UserController();...
A single list can only bind to a single table or view - if you use a view, you may include columns from other objects (unless you look it up using its own controller).

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
3/16/2015 4:41 PM
 

It was a long shot but I took the chance and removed all default code and used a SqlDataSource from the Toolbox->Data then attached a DropDownList to it and I can query whatever table I want. So far I've figured out that as long as they have unique Id's I can have as many of these lists up as I need from different tables at the same time. What I'm messing around with right now:

Seems to be working alright so far. Thanks.

 
Previous
 
Next
HomeHomeDevelopment and...Development and...SQL and SQL Ser...SQL and SQL Ser...DataBind Another TableDataBind Another Table


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