- Home
- Forum
- ASP.NET Web Forms
- Autogenerate Columns From SQL Server Stored Procedure
Autogenerate Columns From SQL Server Stored Procedure
Hi there,
I have a stored procedure that generates results and programmatically assigns values to the 'headers' based on what week of the year it is. (Current Week, and Weeks 1 -52 depending on where we are in the year).
As a result, I cannot hard code the column headers in the Syncfusion Grid - the values need to be automatically assigned.
In ASP the Gridview control has a 'AutoGenerateColumns' property that can be set to 'true' to do this.
https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.gridview.autogeneratecolumns?view=netframework-4.8
Is it possible to do something similar using the Syncfusion Grid control?
Thanks again,
Alex
SIGN IN To post a reply.
3 Replies
MP
Manivannan Padmanaban
Syncfusion Team
May 24, 2019 10:15 AM UTC
Hi Alex,
Thanks for contacting Syncfusion Support. We are happy to assist you.
Query: I cannot hard code the column headers in the Syncfusion Grid - the values need to be automatically assigned.
From the above query, we are able to understand that you want to load the grid columns automatically based on the dataSource. By default, the columns are automatically generated when Columns declaration is empty or undefined while initializing the Grid. Also, all the columns which are in DataSource are bound as a Grid columns.
Kindly refer the below help documentation link,
Regards,
Manivannan Padmanaban.
AR
Alexander Resnik
February 4, 2020 05:16 PM UTC
GL
Gowri Loganathan
Syncfusion Team
February 5, 2020 08:45 AM UTC
Hi Alexander,
Query#: Working example of autogeneration columns.
We have checked your query at our end and we have prepared a sample for autogenerated column. In the below sample, the columns are undefined as shown in the below code snippet.
Kindly refer the code snippet:
|
Aspx page
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True" AllowSorting="True">
// columns are undefined here
</ej:Grid>
<asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString %>"
SelectCommand="SELECT * FROM [Orders]"></asp:SqlDataSource>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
|
Please refer the below screenshot:
Please refer the below sample and documentation:
Documentation: https://help.syncfusion.com/aspnet/grid/columns?&_ga=2.193558893.1711693743.1580704619-1691618470.1569836580#auto-generation
Please revert us if you need more assistance on this.
Regards,
Gowri V L.
SIGN IN To post a reply.
- 3 Replies
- 4 Participants
-
AJ Alex Jermy
- May 23, 2019 02:30 PM UTC
- Feb 5, 2020 08:45 AM UTC