<dx:ASPxGridView ID="gvSkills" runat="server" Border-BorderStyle="None" Width="100%" AutoGenerateColumns="False" Theme="MetropolisBlue">
<Columns>
<dx:GridViewDataTextColumn Caption="SkillInformation" Name="SkillInformation">
<DataItemTemplate>
<div class='block'>
<asp:Label ID="litLanId" Visible="false" Text='<%# Eval("Lan_id") %>' runat="server"></asp:Label>
<div class='block-header'>
<h2 class='block-title'>
<asp:Label ID="LitLang" Text='<%# Eval("Lang") %>' runat="server"></asp:Label>
<asp:Button ID="btnSkillEdit" CssClass="btn btn-xs btn-default push-5-r push-10 pull-right" runat="server" Text=" Edit" OnClick="btnSkillEdit_Click" />
</h2>
</div>
<div class='block-content'>
<address>
<strong>
<asp:Label ID="litUnderstand" Text='<%# Eval("Understand") %>' runat="server"></asp:Label>
</strong>
<br>
<asp:Label ID="LitSpeak" Text=' <%#Eval("Speak") %>' runat="server"></asp:Label>
<br>
<asp:Label ID="LitWrite" Text='<%#Eval("Write") %>' runat="server"></asp:Label>
<br>
<asp:Label ID="litShort" Text='<%# Eval("Shorthand_skill") %>' runat="server"></asp:Label>
<br />
<asp:Label ID="LitType" Text='<%# Eval("Type_skill") %>' runat="server"></asp:Label>
</address>
</div>
</div>
</DataItemTemplate>
</dx:GridViewDataTextColumn>
</Columns>
<Settings ShowColumnHeaders="False" ShowFilterBar="Auto" ShowFooter="True" />
<SettingsDataSecurity AllowDelete="False" AllowEdit="False" AllowInsert="False" />
<Border BorderStyle="None"></Border>
<BorderLeft BorderStyle="None" />
<BorderRight BorderStyle="None" />
<BorderBottom BorderStyle="None" />
</dx:ASPxGridView>
private void BindSkills()
{
try
{
DataTable dt = new BL_EmployeeSkills().SelectSkills(1, Convert.ToInt32(Session["EmployeeNumber"]), 0);
gvSkills.DataSource = dt;
gvSkills.DataBind();
}
catch (Exception ex)
{
PopupMessage.ShowPopup("Oops An Error Occured!", ex.Message);
}
}
I am getting the exception when binding data from codebehind. "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control DataItem template". This occurs on initial binding. Bindings works but the exception always returns in the initial binding. Please help.