here i am give two source file and error also EditDyFlash.ascx(sourcepage ) and EditDyFlash.ascx.cs(codebehind)
my problem is codebehind doesnt support controls in class library , pls tell how can i clear this error
this is my EditDyFlash.ascx file
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="EditDyFlash.ascx.cs" Inherits="DyFlash.EditDyFlash" %>
<%@ Register TagPrefix="dnn" TagName="Label" src="~/controls/LabelControl.ascx" %>
<%@ Register TagPrefix="dnn" TagName="TextEditor" src="~/controls/TextEditor.ascx"%>
<%@ Register TagPrefix="dnn" TagName="Audit" src="~/controls/ModuleAuditControl.ascx" %>
<table width="650" cellspacing="0" cellpadding="0" border="0" summary="Edit Table">
<tr valign="top">
<td class="SubHead" width="125" visible="false"></td>
<td><asp:TextBox ID="txtFlash" Runat="Server" Visible="false" /></td>
</tr>
<tr valign="top">
<td class="SubHead" width="125">Flash Image</td>
<td><asp:FileUpload ID="imgFlash" Width="300px" Runat="Server" />
<asp:linkbutton cssclass="CommandButton" ID="cmdUpdate" OnClick="cmdUpdate_Click" resourcekey="cmdUpdate" runat="server" borderstyle="none" Text="Add"></asp:linkbutton>
<asp:linkbutton cssclass="CommandButton" ID="cmdCancel" OnClick="cmdCancel_Click" resourcekey="cmdCancel" runat="server" borderstyle="none" text="Cancel"></asp:linkbutton>
<asp:linkbutton cssclass="CommandButton" ID="cmdDelete" OnClick="cmdDelete_Click" resourcekey="cmdDelete" runat="server" borderstyle="none" text="Delete"></asp:linkbutton></td>
</tr>
</table>
<p style="margin:0px; padding:0px;">
<span style="color:#ff6600;"><asp:Label ID="lblMsg" Text="" runat="server"></asp:Label><br /></span>
</p>
<asp:Repeater ID="nlist" runat="server">
<HeaderTemplate>
<table border="0" cellspacing="5" cellpadding="0" align="left">
<tr>
<td width="150"><b>Flash Image</b></td>
<td width="100"><b>Options</b></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem, "FlashImage")%> </td>
<td>
<asp:ImageButton ImageUrl="~/Images/edit.gif" ID="BtnDelete" ToolTip="Edit" OnCommand="Delete_Routine" CommandName="Delete" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ItemID") %>' runat="server" Border="0" />
<asp:ImageButton ImageUrl="~/Images/up_arrow.gif" ID="BtnPrevious" ToolTip="Previous_Image" OnCommand="Previous_Routine" CommandName="Previous" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "SortId") %>' runat="server" Border="0" BorderStyle="Ridge" />
<asp:ImageButton ImageUrl="~/Images/next_arrow.gif" ID="BtnNext" ToolTip="Next_Image" OnCommand="Next_Routine" CommandName="Next" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "SortId") %>' runat="server" Border="0" BorderStyle="Ridge" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<dnn:Audit ID="ctlAudit" runat="server" />
<br /><br />
<asp:Button ID="Export" OnClick="Export_Click" Text="Submit" BackColor="AliceBlue" BorderColor="AliceBlue" BorderStyle="Ridge" runat="server" />
EditDyFlash.ascx.cs(codebehind)
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Web.SessionState;
using System.Xml;
using System.Data.Common;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using DotNetNuke;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Search;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
namespace DyFlash
{
/// -----------------------------------------------------------------------------
/// <summary>
/// The EditDyFlash class is used to manage content
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// </history>
/// -----------------------------------------------------------------------------
///
partial class EditDyFlash : PortalModuleBase
{
//protected System.Web.UI.WebControls.Repeater nlist;
//protected System.Web.UI.WebControls.Label lblMsg;
//protected System.Web.UI.WebControls.FileUpload imgFlash;
//protected System.Web.UI.WebControls.LinkButton cmdDelete, cmdCancel, cmdUpdate;
//protected System.Web.UI.WebControls.Audit ctlAudit;
int rowcount;
#region Private Members
private int ItemId = Null.NullInteger;
#endregion
#region Event Handlers
/// -----------------------------------------------------------------------------
/// <summary>
/// Page_Load runs when the control is loaded
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// </history>
/// -----------------------------------------------------------------------------
protected void Page_Load(System.Object sender, System.EventArgs e)
{
try
{
//Determine ItemId of DyFlash to Update
if (this.Request.QueryString["ItemId"] != null && this.Request.QueryString["SortId"] != null)
{
ItemId = Int32.Parse(this.Request.QueryString["ItemId"]);
rowcount = Int32.Parse(this.Request.QueryString["SortId"]);
}
SqlConnection loadCon1 = new SqlConnection(ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString);
SqlCommand loadCmd1 = new SqlCommand("select * from DyFlash where ModuleId=" + ModuleId.ToString() + " and CType='I' order by SortId", loadCon1);
loadCon1.Open();
DataSet HomeGroup = new DataSet();
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = loadCmd1;
adapter.Fill(HomeGroup, "HomeGroup");
loadCon1.Close();
// Bind Data to the repeater
nlist.DataSource = HomeGroup;
nlist.DataBind();
//If this is the first visit to the page, bind the role data to the datalist
if (Page.IsPostBack == false)
{
DyFlashController objDyFlashs1 = new DyFlashController();
DyFlashInfo objDyFlash1 = objDyFlashs1.GetDyFlashGen(ModuleId);
cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");
if (ItemId != -1)
{
//get content
DyFlashController objDyFlashs = new DyFlashController();
DyFlashInfo objDyFlash = objDyFlashs.GetDyFlash(ModuleId, ItemId);
if (objDyFlash != null)
{
ctlAudit.CreatedByUser = objDyFlash.CreatedByUser.ToString();
ctlAudit.CreatedDate = objDyFlash.CreatedDate.ToString();
}
else
{
Response.Redirect(Globals.NavigateURL(), true);
}
if (rowcount != 0)
{
rowcount = 0;
getrowcount();
}
}
else
{
cmdDelete.Visible = false;
ctlAudit.Visible = false;
}
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
//Count the number of records.
public void getrowcount()
{
bindata();
SqlConnection loadCon1 = new SqlConnection(ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString);
SqlCommand loadCmd1 = new SqlCommand("select count(SortId)from DyFlash", loadCon1);
loadCon1.Open();
rowcount = (int)loadCmd1.ExecuteScalar();
loadCon1.Close();
}
void bindata()
{
SqlConnection loadCon1 = new SqlConnection(ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString);
SqlCommand loadCmd1 = new SqlCommand("select FlashImage,SortId from DyFlash where ModuleId=" + ModuleId.ToString() + " and CType='I'", loadCon1);
DataSet HomeGroup = new DataSet();
SqlDataAdapter adapter = new SqlDataAdapter();
DataView dv = new DataView();
DataTable dt = new DataTable();
string strSort = "SortId";
adapter.Fill(HomeGroup, "DyFlash");
dv = HomeGroup.Tables["DyFlash"].DefaultView;
dv.Sort = strSort;
nlist.DataSource = dv;
nlist.DataBind();
loadCon1.Close();
}
//this function retrieve the records
public ArrayList getrecords()
{
int count = 1;
ArrayList ary = new ArrayList();
for (int i = count; i <= rowcount; i++)
{
ary.Add(i);
}
return ary;
}
/// -----------------------------------------------------------------------------
/// <summary>
/// cmdCancel_Click runs when the cancel button is clicked
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// </history>
/// -----------------------------------------------------------------------------
protected void cmdCancel_Click(System.Object sender, System.EventArgs e)
{
try
{
this.Response.Redirect(Globals.NavigateURL(this.TabId), true);
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// cmdDelete_Click runs when the delete button is clicked
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// </history>'
/// -----------------------------------------------------------------------------
protected void cmdDelete_Click(System.Object sender, System.EventArgs e)
{
try
{
//Only attempt to delete the item if it exists already
if (!Null.IsNull(ItemId))
{
DyFlashController objDyFlashs = new DyFlashController();
objDyFlashs.DeleteDyFlash(ModuleId, ItemId);
//refresh cache
SynchronizeModule();
//Redirect back to the portal home page
this.Response.Redirect(Request.Url.AbsolutePath + "?TabId=" + this.TabId + "&ctl=Edit&mid=" + ModuleId, true);
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// cmdUpdate_Click runs when the update button is clicked
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// </history>
/// -----------------------------------------------------------------------------
protected void cmdUpdate_Click(System.Object sender, System.EventArgs e)
{
try
{
string curl;
string referer;
referer = "";
if (imgFlash.HasFile)
{
curl = imgFlash.PostedFile.FileName.ToString();
referer = curl.Substring(curl.LastIndexOf("\\") + 1);
string strFileName;
strFileName = imgFlash.PostedFile.FileName.ToString();
C_Thumbnails(strFileName, referer);
}
DyFlashController objDyFlashs = new DyFlashController();
DyFlashInfo objDyFlash = new DyFlashInfo();
objDyFlash.ModuleId = ModuleId;
if (Null.IsNull(ItemId))
{
objDyFlash.ItemId = ItemId;
}
objDyFlash.FlashImage = referer;
objDyFlash.CreatedByUser = this.UserId;
if (referer == "")
{
lblMsg.Text = "Please select Image to Upload";
}
else
{
//Update the content within the DyFlash table
if (Null.IsNull(ItemId))
{
objDyFlashs.AddDyFlash(objDyFlash);
}
else
{
objDyFlashs.UpdateDyFlash(objDyFlash);
}
//refresh cache
SynchronizeModule();
this.Response.Redirect(Request.Url.PathAndQuery, true);
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
public void C_Thumbnails(string parmFileIn, string Userid)
{
string filePathSourceFile = HttpContext.Current.Server.MapPath("Portals/" + PortalSettings.PortalId.ToString() + "/");
string filePathDestFile = HttpContext.Current.Server.MapPath("~/thumbnails/");
string fullSourceFile = filePathSourceFile + parmFileIn;
int thumbnailHeight, thumbnailHeight1;
int thumbnailWidth, thumbnailWidth1;
System.Drawing.Image sourceImage = System.Drawing.Image.FromFile(parmFileIn);
thumbnailHeight = 91;
thumbnailWidth = 121;
thumbnailHeight1 = 188;
thumbnailWidth1 = 253;
System.Drawing.Image thumbnailImage = sourceImage.GetThumbnailImage(thumbnailWidth, thumbnailHeight, null, IntPtr.Zero);
System.Drawing.Image thumbnailImage1 = sourceImage.GetThumbnailImage(thumbnailWidth1, thumbnailHeight1, null, IntPtr.Zero);
MemoryStream imageStream = new MemoryStream();
MemoryStream imageStream1 = new MemoryStream();
thumbnailImage.Save(imageStream, System.Drawing.Imaging.ImageFormat.Jpeg);
thumbnailImage1.Save(imageStream1, System.Drawing.Imaging.ImageFormat.Jpeg);
string outfile = filePathSourceFile + "s" + ModuleId + "_" + Userid;
string outfile1 = filePathSourceFile + "b" + ModuleId + "_" + Userid;
try
{
thumbnailImage.Save(outfile);
thumbnailImage1.Save(outfile1);
}
catch (Exception e)
{
string dummy = e.ToString();
return;
}
}
protected void Delete_Routine(object sender, CommandEventArgs e)
{
Response.Write("<script language='javascript'>"); //if(confirm('Are you sure to delete?')) {
string curlp = Request.Url.AbsolutePath;
string curlq = Request.Url.Query;
string referer = curlq.Substring(curlq.LastIndexOf("&") + 1, 6);
if (referer == "ItemId")
{
Response.Write("window.location='" + curlp + curlq.Substring(0, curlq.LastIndexOf("&")) + "&ItemId=" + e.CommandArgument + "';");
}
else
{
Response.Write("window.location='" + curlp + curlq + "&ItemId=" + e.CommandArgument + "';");
}
Response.Write("</script>"); //}
}
protected void Previous_Routine(object sender, CommandEventArgs e)
{
DyFlashController objDyFlashs = new DyFlashController();
DyFlashInfo objDyFlash = new DyFlashInfo();
objDyFlash.ModuleId = ModuleId;
objDyFlash.SortId = int.Parse(e.CommandArgument.ToString());
objDyFlashs.SortUpDyFlash(objDyFlash);
//refresh cache
SynchronizeModule();
this.Response.Redirect(Request.Url.PathAndQuery, true);
}
protected void Next_Routine(object sender, CommandEventArgs e)
{
DyFlashController objDyFlashs = new DyFlashController();
DyFlashInfo objDyFlash = new DyFlashInfo();
objDyFlash.ModuleId = ModuleId;
objDyFlash.SortId = int.Parse(e.CommandArgument.ToString());
objDyFlashs.SortDownDyFlash(objDyFlash);
//refresh cache
SynchronizeModule();
this.Response.Redirect(Request.Url.PathAndQuery, true);
}
public void Export_Click(object sender, EventArgs e)
{
DyFlashController objDyFlashs = new DyFlashController();
DyFlashInfo objDyFlash1 = objDyFlashs.GetDyFlashGen(ModuleId);
DyFlashInfo objDyFlash = new DyFlashInfo();
objDyFlash.ModuleId = ModuleId;
if (objDyFlash1 != null)
{
objDyFlashs.UpdateDyFlashGen(objDyFlash);
}
else
{
objDyFlashs.AddDyFlashGen(objDyFlash);
}
String filename = "DyFlash" + ModuleId.ToString() + ".xml";
string curl = Request.Url.AbsoluteUri;
string referer = curl.Substring(0, curl.LastIndexOf("/") + 1);
String imgPath = referer + "Portals/" + PortalSettings.PortalId.ToString() + "/";
SqlConnection loadCon1 = new SqlConnection(ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString);
SqlCommand loadCmd1 = new SqlCommand("select FlashImage from DyFlash where ModuleId=" + ModuleId.ToString() + " and CType='I'", loadCon1);
loadCon1.Open();
XmlTextWriter xw = new XmlTextWriter(Server.MapPath(filename), null);
xw.Formatting = Formatting.Indented;
xw.WriteStartDocument();
xw.WriteStartElement("photos");
SqlDataReader loadRd2 = loadCmd1.ExecuteReader();
while (loadRd2.Read())
{
xw.WriteStartElement("photo");
xw.WriteAttributeString("filename", imgPath.ToString() + "b" + ModuleId + "_" + loadRd2[0].ToString());
xw.WriteAttributeString("thumbnail", imgPath.ToString() + "s" + ModuleId + "_" + loadRd2[0].ToString());
xw.WriteAttributeString("description", "");
xw.WriteEndElement();
}
loadRd2.Close();
xw.WriteEndElement();
xw.WriteEndDocument();
xw.Flush();
loadCon1.Close();
//refresh cache
SynchronizeModule();
//Redirect back to the portal home page
this.Response.Redirect(Globals.NavigateURL(this.TabId), true);
}
#endregion
private void DataSet(string p)
{
throw new Exception("The method or operation is not implemented.");
}
}
}
This is my error
Error 1 The name 'nlist' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 138 21 DyFlash
Error 2 The name 'nlist' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 139 21 DyFlash
Error 3 The name 'cmdDelete' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 150 25 DyFlash
Error 4 The name 'ctlAudit' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 160 33 DyFlash
Error 5 The name 'ctlAudit' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 161 33 DyFlash
Error 6 The name 'cmdDelete' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 176 29 DyFlash
Error 7 The name 'ctlAudit' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 177 29 DyFlash
Error 8 The name 'nlist' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 217 17 DyFlash
Error 9 The name 'nlist' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 218 17 DyFlash
Error 11 The name 'imgFlash' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 308 25 DyFlash
Error 12 The name 'imgFlash' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 310 32 DyFlash
Error 13 The name 'imgFlash' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 314 39 DyFlash
Error 14 The name 'lblMsg' does not exist in the current context D:\DotNetNuke\DesktopModules\Flash\EditDyFlash.ascx.cs 336 25 DyFlash
sorry yar, but try to say how to correct this errors pls ...