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.0When I go to add the new module to a page, nothing happensWhen I go to add the new module to a page, nothing happens
Previous
 
Next
New Post
2/2/2008 11:45 PM
 

Evening Folks.

 

Well, nearly midnight on Saturday, and I'm still plodding along... After spending a good chunk of the day going over the list view and the LinqToSQL DataSource and determining that I can't get multiple database tables into a single LinqToSQL DataSource object but I can manually create the Linq file to pull my existing stored proc, and then that the listview requires the DataSourceObject to work as I want it to, I finally just threw up my hands and went back to building the table manually using the Linq I create for the stored proc and then outputting my tr\td structure...

Works great in my standalone app... I've successfully created the ascx to do what I want... only thing wrong there is it's showing out of order when I render the page...  that is to say it shows up before everything else... So, if you know the answer to that, I need it too...

Anyway, when I take the control which I've created in the DNN solution (vs2008, sql server 2005, c#) and I run the project and create my module definition, everything seems to go fine.  Until I go to add the new module to a page... It's present in the dropdown as a selection choice, but when I click add after selecting it, nothing happens, well, other than the post back.. no new module container, nothing in the page source that I can find... It's like it's just mocking me...

Help?

Brian
(code posted below)

Here's the code for view.ascx (Located under Website\DesktopModules\TeamsByConf)

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="View.ascx.cs" Inherits="DotNetNuke.Modules.TeamsByConf.View" %>

//yep, thats it, one stinking line, the rest is done on page load)

 

Here's the code for the view.ascx.cs file (located under Website\DesktopModules\TeamsByConf)

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using DotNetNuke;
using DotNetNuke.Security;
using TeamsByConf;

namespace DotNetNuke.Modules.TeamsByConf
{
  public partial class View : DotNetNuke.Entities.Modules.PortalModuleBase
  {
        protected void Page_Load(object sender, EventArgs e)
        {
            string CurrentConferenceName = "";
            //bool IsFirstRecord = true;
            bool IsOddRowCount = true;

            TeamsByConfDataContext Teams = new TeamsByConfDataContext();

            var Results = Teams.ff_GetCollegeBasketBallConferenceTeams(null);

            Response.Write("<Table>");
            foreach (ff_GetCollegeBasketBallConferenceTeamsResult CurrRow in Results)
            {
                if (CurrentConferenceName.ToString() == CurrRow.ConferenceName.ToString())
                {

                }
                else
                {
                    Response.Write("<tr bgcolor='white' >");
                    Response.Write("<td>");
                    Response.Write("&nbsp");
                    Response.Write("</td>");
                    Response.Write("</tr>");
                    Response.Write("<th bgcolor='CornflowerBlue' colspan = 4 >");
                    //Response.Write("<td colspan = 4>");
                    Response.Write(CurrRow.ConferenceName);

                    //Response.Write("</td>");
                    Response.Write("<tr>");
                    Response.Write("<td>");
                    Response.Write("<b><u>Team Name</u></b>");
                    Response.Write("</td>");

                    Response.Write("<td>");
                    Response.Write("<b><u>Statistics</u></b>");
                    Response.Write("</td>");

                    Response.Write("<td>");
                    Response.Write("<b><u>Schedule</u></b>");
                    Response.Write("</td>");

                    Response.Write("<td>");
                    Response.Write("<b><u>Players</u></b>");
                    Response.Write("</td>");
                    Response.Write("</tr>");
                    Response.Write("</tr>");

                    CurrentConferenceName = CurrRow.ConferenceName;
                };

                if (IsOddRowCount == true)
                {
                    Response.Write("<tr bgcolor='LightGray'  >");
                    IsOddRowCount = false;
                }
                else
                {
                    Response.Write("<tr bgcolor='white' >");
                    IsOddRowCount = true;
                };
                //Response.Write("<tr>");
                Response.Write("<td>");
                Response.Write(CurrRow.TeamName);
                Response.Write("</td>");
                Response.Write("<td>");
                Response.Write("Statistics");
                Response.Write("</td>");
                Response.Write("<td>");
                Response.Write("Schedule");
                Response.Write("</td>");
                Response.Write("<td>");
                Response.Write("Players");
                Response.Write("</td>");
                Response.Write("</tr>");
            }


            Response.Write("</Table>");
        }

    }

    }

 
New Post
2/3/2008 11:10 AM
 

You do not want to use the "Response.Write". I hope you will follow my advise.

Now to address your frustration at the methods you did try. I urge you to go back and make them work.

1) You can use LInq to do a Join between two tables and then manually bind the results to the ListView (see: http://download.microsoft.com/download/5/8/6/5868081c-68aa-40de-9a45-a3803d8134b8/standard_query_operators.doc). See: http://www.adefwebserver.com/DotNetNukeHELP/Blogs/Linq_FirstLook.htm for examples of manually binding Linq results to a data control.

2) The ListView will do exactly what you need. see: Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
2/3/2008 1:12 PM
 

Michael,

I managed to figure out the further issues I was having and got the module to appear on the page.  The problem was I had something in the key field when I added the control.  Easy enough fix and one I won't be repeating.  Then I got an error when I tried to connect to the second database, that the user '' wasn't recognized.  Easy enough fix, changed it to SQL authentication, changed the connection and bam, it's working, although, it is still displaying very first thing on the page, instead of being containerized like it should be...

I really WOULD like to use the list view control. 

Maybe I'm just being dense here... It's been know to happen.

Your Point 1, of using Linq to join two tables and manually bind the results to the listview.  Yes, I've seen how to do the manual joins and such with Linq on the code behind page.  The problem is, that due to the occasional changes that occur within our database, the structure is not FULLY stable on a long term basis.  Yes, I could manually join the tables and then work with it that way (I think LINQDataSources can handle this, although I'm not 100% sure of that fact.) but the problem is that right now we're using stored procedures on the database to return the data.  That way, if there is a structural change, all we have to do is change the stored procedure and no changes are required on the front end to adapt to it.  I'm not saying this is a requirement which cannot change, but I'll need to be able to present a solid case to my boss to do so...

So, here's my current thought process... Instead of using the LINQ datasource object on the control or page, which does not SEEM to be able to be created with a Stored Procedure as the datafeed, I'm thinking I can use a SQLDataSource... It's not what everybody seems to be recommending but I believe that it will do what I want, which is to be able to hook to a listview control properly, take one or more parameters as input if needed, and seems like it won't cause any conflicts within DNN..

The only problem I foresee is that I'd really like to do something like is show here http://mattberseth.com/blog/2008/01/building_a_grouping_grid_with.html

but I believe that the example is heavily based off of the Linq datasource for the group by functionality... I'm hoping I can replicate this in the ListView without using the Linq Data Source... I figure if nothing else, I could use some conditional if statements to determine if the record is the first in a grouping, much like I did in the manual output entry...

Does this sound viable to you?

Thanks,
Brian

 
New Post
2/3/2008 2:08 PM
 

1) I just posted some code that shows how to use the LIstView with grouping (Creating a DotNetNuke Module using LINQ to SQL (C#) (Part 3) ). Matt Berseth's code will cause problems with DotNetNuke because he uses JavaScript to "roll up" the groups. If more than one instance of the module is placed on a page you can have conflicts. Also he didn't show you how to select an item. Anyway there is some more sample code for you there.

2) You CAN use the LinqDataSource control with stored procedures (see: http://weblogs.asp.net/scottgu/archive/2007/08/16/linq-to-sql-part-6-retrieving-data-using-stored-procedures.aspx). You can then bind this to the LinqDataSource control

I cannot recommend the SQLDataSource control at all.



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
2/3/2008 9:21 PM
 

Michael,

I have gone back and reviewed some of what I've done, and I went ahead and created the database connection...

        protected void Page_Load(object sender, EventArgs e)
        {
            NorthwindDataContext Billing = new NorthwindDataContext();

            var Invoices= Billing.CustOrdersOrders("Alfki");

            InvoicesGrid.DataSource = Invoice;

            InvoicesGrid.DataBind();
        }


I have also successfully managed to do some VERY basic formatting with the ListView to get at least SOME of the information showing... So, at this point, I have made demonstratable progress.. .*chuckles* I think I was actually close to this point yesterday sometime and ended up going down a rabbit hole after something.  Ah, the joys of a learning curve while programming.

The problem I'm running into is that I want to display information which has a parent child relationship... I need to show the header of the Customer Name off of the Invoice (the primary key of which is an integer PK) AND the Invoice ID as the header information (or group by if you will), and then I want to have the line items, which are in a child\detail table off of the invoice table (MasterTable = Invoice, detail table = InvoiceLineItems). 

Now, I have reread the link that you sent (http://weblogs.asp.net/scottgu/archive/2007/08/16/linq-to-sql-part-6-retrieving-data-using-stored-procedures.aspx) and I think either I have a misconception here or we're having a failure to communicate. 

You say that I can bind a stored procedure to the LINQ datasource.  If I'm understanding correctly, you do this by dropping a stored procedure onto one of the table objects in the designer.  The example says, make your stored procedure simply select * from table name in order to make this functional.  The problem is, that that's not what I want from my stored procedure...  I want to have my stored procedure return specific data columns from two related tables (Master\detail) so that I can display things appropriately in my listview.

Now, I know how you can do the group by from the LINQ data source (using the key, count and IT as items), but, the problem as I see it is that your object model has to match your tables 100% and that if you have partial datasets from multiple tables coming back, then it's not going to be within the framework that is being forced by the LINQ structure...

I'm hoping there is a way around this, or that Microsoft is going to expand the LINQ DataSource functionality in the future... I found exactly one other example which was like mine in my google searching, and it ended with a guy from microsoft telling the original poster that if he had suggestions for future versions of LINQ, then go to a page and submit the request.... Basically, an admission that it won't do what this guy, and myself, need it to do...

What's really frustrating here is that its close... I can see my objective, but the road just doesn't seem to reach there yet... I'm going to keep looking for a work around, and Michael, I really do appreciate the time and your responses to my questions\problems... But, I've spent all afternoon with one of my mentors and co-workers and we keep coming up against the same roadblocks... Most of which seem to be ASP.net oriented, not DNN...

Oh well, we don't always manage to get things to work out the way we want them to when exploring new technologies...  But, we keep looking...

Brian

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0When I go to add the new module to a page, nothing happensWhen I go to add the new module to a page, nothing happens


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