Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
WebGrid : Databinding Problem
posted

Hi, 

I have used the following code to bind the data field. This code is working fine when I load the page first time. Then the subsequent calls I am getting an error like this "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."

   <igtbl:UltraWebGrid ID="gvOptions" runat="server" Height="350px" Width="765px">
                    <Bands>
                        <igtbl:UltraGridBand>
                            <Columns>
                                <igtbl:TemplatedColumn AllowGroupBy="No" AllowResize="Fixed" AllowRowFiltering="False"
                                    AllowUpdate="No" IsBound="True" Hidden="True">
                                    <Header Caption="OptionID"></Header>
                                    <CellTemplate>
                                        <asp:Label runat="Server" ID="lblOptionID" Text='<%#Bind("OptionID")%>'></asp:Label>
                                    </CellTemplate>
                                </igtbl:templatedColumn>
                        </igtbl:UltraGridBand>
                    </Bands>
   </igtbl:UltraWebGrid>


How to rectify this problem. Kindly help me in this regard.

  • 80
    posted

     Hi, It seems that you are not initializing datasource.  You may want to initialize the datasource at OnInitializeDataSource event.  This should solve your problem.