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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Empty

Thread ID:

Created:

Updated:

Platform:

Replies:

130636 May 23,2017 07:12 AM UTC May 24,2017 06:31 AM UTC ASP.NET Web Forms 1
loading
Tags: Grid
Hrvoje Voda
Asked On May 23, 2017 07:12 AM UTC

Is there a way to show grid without data? 
So, to see only columns?


Venkatesh Ayothi Raman [Syncfusion]
Replied On May 24, 2017 06:31 AM UTC

Hi Hrvoje, 

Thanks for contacting Syncfusion support. 

Yes, we can bound the empty data source to the Grid and showing the Grid columns without data by passing the empty list like as follows, 
Code example
@Grid 
 
<ej:Grid ID="Grid1"    AllowPaging="True"   runat="server"> 
            <Columns> 
                <ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true"    TextAlign="Right" Width="90" /> 
                <ej:Column Field="CustomerID" HeaderText="Customer ID"   Width="100"  /> 
                <ej:Column Field="EmployeeID" HeaderText="Employee ID"   TextAlign="Right" Width="110"  /> 
                <ej:Column Field="Freight" HeaderText="Freight"  TextAlign="Right" Width="90" Format="{0:C}" /> 
                <ej:Column Field="OrderDate" HeaderText="Order Date" Width="100"   TextAlign="Right" Format="{0:MM/dd/yyyy}" /> 
                <ej:Column Field="ShipCity" HeaderText="Ship City" Width="100" /> 
            </Columns> 
             
<ToolbarSettings ShowToolbar="True" ToolbarItems="  add,edit,delete,update,cancel"> 
</ToolbarSettings> 
              
        </ej:Grid> 
 
@code behind 
 
List<Orders> order = new List<Orders>(); 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            BindDataSource(); 
        } 
        private void BindDataSource() 
        { 
             
            this.Grid1.DataSource = order; //bind the empty data source 
            this.Grid1.DataBind(); 
        } 

Output
 
We have also prepared a sample for your convenience which can be download from following link, 

Regards, 
Venkatesh Ayothiraman. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;