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...Getting StartedGetting StartedProblem with Module DevelopmentProblem with Module Development
Previous
 
Next
New Post
10/3/2016 4:19 AM
 
Hi All

Apologies in advance for noob questions, I am fairly new to DNN, I have been helping a friend to develop a website, generally it is going well, but I am however getting stuck when I try develop my own modules, they are fairly simple modules but yet they both keep throwing the below errors:


 

Below is the code for both the above:

COF RANKINGS:

ASP

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="View.ascx.cs" Inherits="COF.Airsoft.COFRankings.View" %>

<asp:Repeater ID="rptCustomers" runat="server">

    <HeaderTemplate>

        <table cellspacing="0" rules="all" border="1">

            <tr>                

                <th scope="col" style="width: 350px">

                    Username

                </th>

                <th scope="col" style="width: 250px">

                    DisplayName

                </th>

            </tr>

    </HeaderTemplate>

    <ItemTemplate>

        <tr>            

            <td>

                <asp:Label ID="lblContactName" runat="server" Text='<%# "Username") %>' />

            </td>

            <td>

                <asp:Label ID="lblCountry" runat="server" Text='<%# "DisplayName") %>' />

            </td>

        </tr>

    </ItemTemplate>

    <FooterTemplate>

        </table>

    </FooterTemplate>

</asp:Repeater>


Code Behind

protected void Page_Load(object sender, EventArgs e)

        {

            try

            {

                if (!this.IsPostBack)

                {

                    this.BindRepeater();

                }

            }


private void BindRepeater()

        {

            string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;

            using (SqlConnection con = new SqlConnection(constr))

            {

                using (SqlCommand cmd = new SqlCommand("SELECT Username, DisplayName  FROM Users", con))

                {

                    using (SqlDataAdapter sda = new SqlDataAdapter(cmd))

                    {

                        DataTable dt = new DataTable();

                        sda.Fill(dt);

                        rptCustomers.DataSource = dt;

                        rptCustomers.DataBind();

                    }

                }

            }            

        }

 

YOUR RANK:

ASP

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="View.ascx.cs" Inherits="Cof.Airsoft.YourRank.View" %>

<asp:Image ID="RankImg" runat="server" /><br />

<asp:Label ID="Label1" runat="server" Text="XP: " Font-Bold="True" Font-Size="X-Large" ForeColor="#BF1F27"></asp:Label>

<asp:Label ID="XP" runat="server" Text="Recruit"  Font-Size="X-Large" ForeColor="#BF1F27" Font-Bold="False"></asp:Label>


Code Behind

RankImg.ImageUrl = UserInfo.Profile.GetProperty("RankImage").ToString();

                XP.Text = UserInfo.Profile.GetProperty("Rank").ToString();


Thanks

 
New Post
10/3/2016 5:35 AM
 
please provide full stack trace of the error from DNN Event Log (in Admin menu)

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
10/3/2016 2:25 PM
 

Thanks for the quick reply, is the below what you are referring too?

 

ModuleId:2733

ModuleDefId:165

FriendlyName:YourRank

ModuleControlSource:DesktopModules/YourRank/View.ascx

AbsoluteURL:/Default.aspx

DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke

ExceptionGUID:691bc2f8-aa29-4904-a3c3-bb89c658888b

AssemblyVersion:8.0.3

PortalId:0

UserId:1

TabId:218

RawUrl:/RANKS.aspx

Referrer:http://www.cofairsoft.co.za/login.aspx?ReturnUrl=%2fRANKS.aspx

UserAgent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36

ExceptionHash:uDz29EA57M7+2erfVYX4bg==

Message:Object reference not set to an instance of an object.

StackTrace:


 

InnerMessage:Object reference not set to an instance of an object.

InnerStackTrace:

   at Cof.Airsoft.YourRank.View.Page_Load(Object sender, EventArgs e)

 

Source:

FileName:

FileLineNumber:0

FileColumnNumber:0

Method:

Server Name: PLESK01-CPT

 

ModuleId:2734

ModuleDefId:164

FriendlyName:COFRankings

ModuleControlSource:DesktopModules/COFRankings/View.ascx

AbsoluteURL:/Default.aspx

DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke

ExceptionGUID:667dd17c-c5e4-4011-a296-3316273a30e2

AssemblyVersion:8.0.3

PortalId:0

UserId:1

TabId:218

RawUrl:/RANKS.aspx

Referrer:http://www.cofairsoft.co.za/login.aspx?ReturnUrl=%2fRANKS.aspx

UserAgent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36

ExceptionHash:lo+tiwcaGaJke80EpxgaOA==

Message:Object reference not set to an instance of an object.

StackTrace:


 

InnerMessage:Object reference not set to an instance of an object.

InnerStackTrace:

   at COF.Airsoft.COFRankings.View.BindRepeater()
   at COF.Airsoft.COFRankings.View.Page_Load(Object sender, EventArgs e)

 

Source:

FileName:

FileLineNumber:0

FileColumnNumber:0

Method:

Server Name: PLESK01-CPT

 

 

 
New Post
10/3/2016 5:03 PM
 
maybe constr is not declared in web.config or it doesn't provide access to users table, you should compile in debug mode and copy over .pdb files to get precise line number in BindRepeater method.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
10/4/2016 1:26 AM
 

Thanks Sebastian 

Not only did I find the problem, i learnt a lot from the debugging process.


Regards

Craig


 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedProblem with Module DevelopmentProblem with Module Development


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