Hi I am new to this system, please be gentle with me. The problem I am now having is the inability to call the class file from ASPX through Eval. The class file is located in “~/classes” folder. Please provide me with methods and ways to evade this error or even solve it thank you!! ^^
Programming language : C#
Problem found in : .ASPX gridView
Problem also found in : EstateDBManager class file
Error Message : DataBinding: ‘DWAD_Project.classes.Volunteer’ does not contain a property with the name ‘EstateDBManager’.
Codes for partial gridView below :
<asp:TemplateField HeaderText="Estate Name" SortExpression="EstateId">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("EstateDBManager.findEstate({0}).Name") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("EstateDBManager.findEstate({0}).Name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Codes for partial EstateDBManager Class file below:
namespace DWAD_Project.classes
{
public static class EstateDBManager
{
public static Estate findEstate(int ID)
{
// processes ...
}
}
}
Thanks for replies and helps!! ^^
Answer to the problem:
GridView :
<asp:TemplateField HeaderText="Estate Name" SortExpression="EstateId">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# DWAD_Project.classes.EstateDBManager.findEstate(Eval("EstateId")).Name %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# DWAD_Project.classes.EstateDBManager.findEstate(Eval("EstateId")).Name %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Class file :
namespace DWAD_Project.classes
{
public static class EstateDBManager
{
public static Estate findEstate(int ID)
{
// processes ...
}
}
}
Eval is for properties of the data source. If you need just code don’t use Eval
You just have to convert the Eval result to the right type since it is object (e.g. (int)Eval(“EstateId”))