0

<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.

  • 2
    Possible duplicate of [Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control](http://stackoverflow.com/questions/2571545/databinding-methods-such-as-eval-xpath-and-bind-can-only-be-used-in-the) – bit Dec 22 '15 at 05:06
  • Duplicate binding as in? Data? – Lourdes Adheesha Dec 22 '15 at 05:11

0 Answers0