The error I am getting is:
CS1061: 'Web2Print.ArtworkLabel' does not contain a definition for 'ID' and no extension method 'ID' accepting a first argument of type 'Web2Print.ArtworkLabel' could be found (are you missing a using directive or an assembly reference?)
On the line:
string FormVal = Request.Form["label" + TheLabel.ID];
The code block the line is in is:
public void SaveData(object sender, EventArgs e)
{
// New data record
ArtworkData DataRecord = new ArtworkData(DataID);
DataRecord.LoadTemplate();
DataRecord.Template.LoadLabels();
DataRecor开发者_如何学Pythond.LoadDataLabels();
// Delete all from DB
ArtworkCommon.DeleteDataLabels(DataID);
ArrayList LabelsCollection = new ArrayList();
// Loop through all the fields
foreach (ArtworkLabel TheLabel in DataRecord.Template.Labels)
{
string FormVal = Request.Form["label" + TheLabel.ID];
The definition of ArtworkLabel
is:
/// <summary>
/// A template label
/// </summary>
public class ArtworkLabel
{
public bool Loaded { get; set; }
public int ID { get; set; }
public string Text { get; set; }
public LabelStyle Style { get; set; }
public Coordinate Coords { get; set; }
public int TemplateID { get; set; }
public int PageNumber { get; set; }
The code isn't very well formed, I know. The function throwing the error exists in namespace Web2Print
, but the ArtworkLabel
class does not exist in a namespace. I don't think this should be a problem.
I've tried rebuilding, clearing temp files as well.
The function throwing the error exists in namespace Web2Print, but the ArtworkLabel class does not exist in a namespace
Everything must be in a namespace. Figure out what namespace ArtworkLabel is in, and refer to it as ArtworkLabelNameSpace.ArtworkLabel
.
Also check if there's a control called ArtworkLabel
in your ASPX file; the error message sounds like it actually finds a matching object, but the object doesn't define an ID property.
精彩评论