We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Webforms Grid - ToolBar / Rendering Error

Hi,

the moment I add the following:

<ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>

to my grid, the grid gives my the following data source error:

There was an error renderinge the control. The DatasourceID of Grid1 must be the ID of a control of type IDatasource....

I then need to relink the data source for the grid to display.



1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team March 31, 2017 02:47 PM UTC

Hi Danie, 

Thanks for contacting Syncfusion support. 

Query: Error thrown as “ The DatasourceID of Grid1 must be the ID of a control of type IDatasource”. 

We have analyzed your query and we suspect that you bind the SqlDataSource in Grid. If we miss to add the  SqlDataSource connecting string in the Grid code then the reported issue get reproduced. 
Please ensure that you have add the SqlDataSource connection string to the sample and the ID given in the SqlDataSource connection string, DataSourceID value of ejGrid property both are same.  

Refer the below code example. 


<ej:Grid ID="Grid1" runat="server" DataSourceID="SqlData" Query ="new ej.Query().from('Orders').select(['OrderID', 'CustomerID', 'EmployeeID', 'ShipCity', 'Freight']).take(5)">  
       <EditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" EditMode="Dialog" /> 
            <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings> 
            <Columns> 
                 
               --------------------- 
            </Columns>            
                         
        </ej:Grid> 
        <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>" 
            SelectCommand="SELECT * FROM [Orders]"></asp:SqlDataSource> 


We have prepared a sample and it can be downloadable from the below location. 


If you still face the same issue then please get back to us with the following details for better assistance. 

  1. Screen shot or video demonstration of the issue.
  2. Share the Grid code example.
  3. Essential studio version.
  4. Stack trace of the issue.
  5. If possible share the sample or reproduce the issue in the attached sample.

Regards, 
Thavasianand S. 


Loader.
Live Chat Icon For mobile
Up arrow icon