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