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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0IDID's always 0
Previous
 
Next
New Post
2/6/2007 12:14 PM
 
I am coding a news module, using the new C# compiled module, for my organization (DNN4.4.1 Starter Kit). I have passed URL values before but something is a miss here. I use the following line of code to assign the NewsId as a URL variable. This code works fine except that the value is always zero (0).

((HyperLink)e.Item.FindControl("hypMore")).NavigateUrl = EditUrl("NewsId", ((WyleNewsInfo)e.Item.DataItem).NewsId.ToString(), "ViewWyleNewsDetails");



Here are my constructors:

// initialization
public WyleNewsInfo() {} // Empty Constructor
public WyleNewsInfo(int news_Id, int status_Id, int module_Id, string title, DateTime date_Entered, string created_By, DateTime expiration_Date, string content, DateTime edited_Date, string edited_By, string attachment, string url, string heading, string times_Accessed, int location_Id, int group_Id)
{
this.NewsId = news_Id;
this.StatusId = status_Id;
this.ModuleId = module_Id;
this.Title = title;
this.DateEntered = date_Entered;
this.CreatedBy = created_By;
this.ExpirationDate = expiration_Date;
this.Content = content;
this.EditedDate = edited_Date;
this.EditedBy = edited_By;
this.Attachment = attachment;
this.Url = url;
this.Heading = heading;
this.TimesAccessed = times_Accessed;
this.LocationId = location_Id;
this.GroupId = group_Id;
}


Anyone have any idea's besides scrapping Reflection and implimenting an ADO.NET alternative.

Cheers!

The fields are in the same order as the return values from the stored procedure and the data types are correct; however, the case of the variables are not exactly the same. I don't think that makes a difference, but I might try it out after lunch.In the SqlDataProvider my GetNews function uses reflection to pull the values from the database and that works too, mostly... I get the values in my content and the title fields, but I don't get any of the other fields. Plus, I am not throwing any exceptions. Here is where it get's weird. When I use SQL Profiler and execute the captured stored procedure call in the Query Analyzer window (SQL Server 2005 Developer Edition), all the values are returned as expected. So it would seem that my constructor in my Info class is not working as expected.

Cheers!
John Valentine
http://www.webinnovationsystems.com
 
New Post
2/6/2007 12:27 PM
 
WTH?? Not sure what happened to the formatting... Hope you can still decipher what I am saying...

Cheers!
John Valentine
http://www.webinnovationsystems.com
 
New Post
2/6/2007 2:14 PM
 
Ok, I have determined that the CBO.FillCollection is instancing my Info class using the default (empty) constructor. The following line of code seems to be the culprate:

return CBO.FillCollection(DataProvider.Instance().GetWyleNews(ModuleId, GroupId, LocationId));

Does anyone know why this line of code is instancing the default constructor rather than the initializer constructor?

Thanks!


Cheers!
John Valentine
http://www.webinnovationsystems.com
 
New Post
2/6/2007 3:40 PM
 

I think that is the way the CBO class works.

It is designed to use the empty constructor.


Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
2/6/2007 4:02 PM
 
Thanks for the update. You seem to be correct, although this shouldn't be the case. If I may be so bold...

.NET is able to distinguish between the constructors and use the correct one. I ended up having to loop through my results manually add them to a generic List. If DNN is going to continue to utilize a provider model that implements an IDataReader return type, the FillCollection function should be modified to be able to return that interface. In turn developers such as myself should only have to write a constructor that implements IDataReader as an argument in order to correctly insantiate the class as an object.

Just my .02 cents...

Thanks,

HisKid


Cheers!
John Valentine
http://www.webinnovationsystems.com
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0IDID's always 0


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