Hi Guys...
*chuckles* ok... Here's where I'm at...
I've tried using the various template mechanisms out there, with less than stellar results, so as a result I got frustrated and tried from scratch.
I've managed to create a DNN module, following the SuperSimple walkthrough http://www.adefwebserver.com/DotNetNukeHELP/DNN_ShowMeThePages/Default.htm
I've managed to get that to work and it's showing up successfully on the site when I plug the module in...
Now, I've also created a class in a stand alone test website which outputs the table layout, with data, the way I want from the database (I'm using SQLServer 2005 as my db engine, both for my local test (where the actual DNN database for my local test copy resides) and for the engine where the db already exists where I'm wanting to pull the production data from. I don't need to build any tables or stored procs for the module, because it's pre-existing.
Now, I've used the C# templates, and followed the documentation provided here
http://www.bitethebullet.co.uk/DNN4CSharpTemplate/tabid/79/Default.aspx
But, I'll be honest, something must have gone wrong because when I tried to add the module to the content panel, I couldn't even get anything to display.
So, anyway.. I have a class which works when I drop it on an ascx in the standalone site, then put that control on a page, it works perfectly. So, I know that my class (which does use a dataset object and tableadapters in vs2005) is working correctly.
The problem is, when I try to move this functionality into the DNN solution, everything goes to pot.
I have recreated the dataset in the dnn solution, yet it's not available in intellisense. I create new ones, none of them show up. I've created the class, creating the SQL connection manually in the code and populating a datareader to get around that problem, and I BELIEVE that everything is correct (mind you, I'm new to C# after about 5 years in vb.net as well, *chuckles*) But, my class is not showing up in the toolbar at all to be placeable (all the DNN Items are showing up in the toolbar however...)
At this point, I'm quite frustrated, because as far as I can tell, I'm doing everything correctly, yet I'm getting no consistency in behavior in the IDE in a project versus a solution.
The only thing I have not been able to completely eliminate from my list of issues is namespace in the test website versus in the DNN solution, but as of yet, I've not been able to find where you can set those in the solution file....
Any tips or suggestions you might be able to offer me would be appreciated.
Thanks,
Brian
Pasting below the code I'm wanting to get working as an ASCX so I can bring it in as a module. It IS working as a class just fine when I drop it onto an ASCX, just not in the DotNetNuke solution..
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace SiteName
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:GroupsByConference runat=server></{0}:GroupsByConference>")]
public class GroupsByConference : WebControl
{
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("")]
[Localizable(true)]
public string Text
{
get
{
String s = (String)ViewState["Text"];
return ((s == null) ? String.Empty : s);
}
set
{
ViewState["Text"] = value;
}
}
protected override void RenderContents(HtmlTextWriter output)
{
string CurrentConferenceName = "";
bool IsFirstRecord = true;
bool IsOddRowCount = true;
output.Write(Text);
DataSet1TableAdapters.ff_GetConferenceGroupsTableAdapter gcb = new SiteName.DataSet1TableAdapters.ff_GetConferenceGroupsTableAdapter();
DataSet1.ff_GetConferenceGroupsDataTable datatable = new DataSet1.ff_GetConferenceGroupsDataTable();
gcb.Fill(datatable, null);
foreach (DataRow CurrentDataRow in datatable.Rows)
{
DataSet1.ff_GetConferenceGroupsRow nr = (DataSet1.ff_GetConferenceGroupsRow)CurrentDataRow;
if (CurrentConferenceName.ToString() == nr.ConferenceName.ToString())
{
}
else
{
if (IsFirstRecord == true)
{
output.Write("<Table>");
IsFirstRecord = false;
}
else
{
}
output.Write("<tr bgcolor='white' >");
output.Write("<td>");
output.Write(" ");
output.Write("</td>");
output.Write("</tr>");
output.Write("<th bgcolor='CornflowerBlue' colspan = 4 >");
//output.Write("<td colspan = 4>");
output.Write(nr.ConferenceName);
//output.Write("</td>");
output.Write("<tr>");
output.Write("<td>");
output.Write("<b><u>Name Column</u></b>");
output.Write("</td>");
output.Write("<td>");
output.Write("<b><u>Header Column 1</u></b>");
output.Write("</td>");
output.Write("<td>");
output.Write("<b><u>Header Column 2</u></b>");
output.Write("</td>");
output.Write("<td>");
output.Write("<b><u>Header Column 3</u></b>");
output.Write("</td>");
output.Write("</tr>");
output.Write("</tr>");
CurrentConferenceName = nr.ConferenceName;
};
if (IsOddRowCount == true)
{
output.Write("<tr bgcolor='LightGray' >");
IsOddRowCount = false;
}
else
{
output.Write("<tr bgcolor='white' >");
IsOddRowCount = true;
};
output.Write("<tr>");
output.Write("<td>");
output.Write(nr.GroupName);
output.Write("</td>");
output.Write("<td>");
output.Write("Statistics");
output.Write("</td>");
output.Write("<td>");
output.Write("Schedule");
output.Write("</td>");
output.Write("<td>");
output.Write("Members");
output.Write("</td>");
output.Write("</tr>");
}
output.Write("</Table>");
}
}
}