1. Tag Results
headers (14)
1 - 14 of 14
How to set different background color for each column header in MAUI DataGrid (SfDataGrid)?
The .NET MAUI DataGrid(SfDataGrid)  allows you to set different background color for each column header by using the DataGridColumn.HeaderTemplate property. The below code illustrates how to set the different background color for each column header. XAML <syncfusion:SfDataGrid x:Name ="dataGrid"                    AutoGenerateColumnsMode="None"                    ItemsSource="{Binding Employees}">       <syncfusion:SfDataGrid.Columns>         <syncfusion:DataGridTextColumn MappingName="EmployeeID">             <syncfusion:DataGridTextColumn.HeaderTemplate>                 <DataTemplate>                     <Label Text="Employee ID"                        FontAttributes="Bold"                        TextColor="Black"                        BackgroundColor="Gray"                        VerticalTextAlignment="Center"                        HorizontalTextAlignment="Center"/>                 </DataTemplate>             </syncfusion:DataGridTextColumn.HeaderTemplate>         </syncfusion:DataGridTextColumn>           <syncfusion:DataGridTextColumn MappingName="Name">             <syncfusion:DataGridTextColumn.HeaderTemplate>                 <DataTemplate>                     <Label Text="Name"                        FontAttributes="Bold"                        TextColor="Black"                        BackgroundColor="Blue"                        VerticalTextAlignment="Center"                        HorizontalTextAlignment="Center" />                 </DataTemplate>             </syncfusion:DataGridTextColumn.HeaderTemplate>         </syncfusion:DataGridTextColumn>           <syncfusion:DataGridTextColumn MappingName="IDNumber">             <syncfusion:DataGridTextColumn.HeaderTemplate>                 <DataTemplate>                     <Label Text="ID Number"                        FontAttributes="Bold"                        TextColor="Black"                        BackgroundColor="Aqua"                        VerticalTextAlignment="Center"                        HorizontalTextAlignment="Center"/>                 </DataTemplate>             </syncfusion:DataGridTextColumn.HeaderTemplate>         </syncfusion:DataGridTextColumn>         <syncfusion:DataGridTextColumn MappingName="Title">             <syncfusion:DataGridTextColumn.HeaderTemplate>                 <DataTemplate>                     <Label Text="Title"                        FontAttributes="Bold"                        TextColor="Black"                        BackgroundColor="Maroon"                        VerticalTextAlignment="Center"                        HorizontalTextAlignment="Center"/>                 </DataTemplate>             </syncfusion:DataGridTextColumn.HeaderTemplate>         </syncfusion:DataGridTextColumn>     </syncfusion:SfDataGrid.Columns> </syncfusion:SfDataGrid> View Sample of GitHub Take a moment to pursue this documentation, where you can find more about Syncfusion .NET MAUI DataGrid (SfDataGrid) with code examples. Please refer to this link to learn about the essential features of Syncfusion .NET MAUI DataGrid (SfDataGrid).   Conclusion I hope you enjoyed learning about how to set different background color for each column header in MAUI DataGrid (SfDataGrid). You can refer to our .NET MAUI DataGrid’s feature tour page to know about its other groundbreaking feature representations. You can also explore our .NET MAUI DataGrid Documentation to understand how to present and manipulate data. For current customers, you can check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our .NET MAUI DataGrid and other .NET MAUI components. If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac or feedback portal. We are always happy to assist you!  
How to change the header image of the cell in WinForms Grid Control?
Change the header image position CounterLogic property is used to be within the engine. If you have large data source and need support for groups and filtered records, you can reduce the memory footprint by selectively disabling counters that you do not need in your application. Since we have large data in the application, the Group Caption Image is not properly viewed always. Hence, using CounterLogic would reduce the memory footprint and all the data will be displayed always. C# gridgroupingcontrol.CounterLogic = EngineCounters.FilteredRecords; //Smallest memory footprint.   VB gridgroupingcontrol.CounterLogic = EngineCounters.FilteredRecords 'Smallest memory footprint.   Screenshot Sample: VB: GroupCaptionPlusMinusCell_VB  ConclusionI hope you enjoyed learning on how to change the header image of the cell in WinForms Grid groupingControl.You can refer to our WinForms Grid feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to present and manipulate data.For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our ASP.NET MVC Chart and other ASP.NET MVC components.If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
Add request header for upload action
Description: To add a request header during upload action in Upload box. Solution: You can add a custom request reader in upload box action during beforeSend event of Uploadbox which will be triggered before file has been sent to the server. Please refer to the below code:  <script type="text/javascript">           $(function () {               // declaration               $("#UploadDefault").ejUploadbox({                   saveUrl: "api/UploadBox",                    beforeSend: function (args) {                    args.xhr.setRequestHeader("securityToken", "23456");                    }               });           });   </script>       public class UploadBoxController : ApiController     {           [AcceptVerbs("Post")]         public void Save()         {             if (HttpContext.Current.Request.Files.AllKeys.Any())             {                 var httpPostedFile = HttpContext.Current.Request.Files["Uploadbox"];                   if (httpPostedFile != null)                 {                     var fileSave = HttpContext.Current.Server.MapPath("UploadedFiles");                     if (!Directory.Exists(fileSave))                     {                         Directory.CreateDirectory(fileSave);                     }                     var fileSavePath = Path.Combine(fileSave, httpPostedFile.FileName);                                        httpPostedFile.SaveAs(fileSavePath);                 }             }         }    }   You can get the header details from HttpContext.Current.Request.Headers. Security token details can be viewed in network tab as shown in the below image.     Sample: Uploadheader399918897
How to add row numbers for the header or caption rows in a WinForms GridGroupingControl?
Header row To have a numbered row header in the GridGroupingControl, there are two possible ways. Use of NumberedRowHeaders property. Use GridRangeInfo.GetNumericLabel() in PrepareViewStyleInfo event C# Method1: this.gridGroupingControl1.Appearance.AnyHeaderCell.CellType =GridCellTypeName.Header;this.gridGroupingControl1.TableModel.Options.NumberedRowHeaders =true;   Method2: //To display the Numbered row headerthis.gridGroupingControl1.TableControl.PrepareViewStyleInfo += TableControl_PrepareViewStyleInfo;   private void TableControl_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) {     GridTableCellStyleInfo style = e.Style as GridTableCellStyleInfo;     if (style != null && style.TableCellIdentity != null && style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)     {         Record record = this.gridGroupingControl1.Table.Records[0];         int firstIndex = record.GetRowIndex();         if (e.RowIndex >= this.gridGroupingControl1.TableControl.TopRowIndex && e.ColIndex == 0)         {             e.Style.CellType = "Header";             e.Style.CellValue = GridRangeInfo.GetNumericLabel(e.RowIndex - firstIndex + 1);         }     } }   VB Method1: Me.gridGroupingControl1.Appearance.AnyHeaderCell.CellType =GridCellTypeName.Header Me.gridGroupingControl1.TableModel.Options.NumberedRowHeaders =True   Method2: 'To display the Numbered row header Me.gridGroupingControl1.TableControl.PrepareViewStyleInfo += TableControl_PrepareViewStyleInfo   Private Sub TableControl_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs)     Dim style As GridTableCellStyleInfo = TryCast(e.Style, GridTableCellStyleInfo)     If style IsNot Nothing AndAlso style.TableCellIdentity IsNot Nothing AndAlso style.TableCellIdentity.DisplayElement.Kind Is DisplayElementKind.Record Then         Dim record As Record = Me.gridGroupingControl1.Table.Records(0)         Dim firstIndex As Integer = record.GetRowIndex()         If e.RowIndex >= Me.gridGroupingControl1.TableControl.TopRowIndex AndAlso e.ColIndex = 0 Then             e.Style.CellType = "Header"             e.Style.CellValue = GridRangeInfo.GetNumericLabel(e.RowIndex - firstIndex + 1)         End If     End If End Sub   Screenshot Samples: C#: HeaderCaption_CS VB: HeaderCaption_VB Reference link: https://help.syncfusion.com/windowsforms/gridgrouping/appearance-and-formatting
How to change the visibility of Formula Bar headers in WinForms (SfSpreadsheet)?
Visibility of Formula Bar and header at runtime The WinForms Spreadsheet control allows you to change the visibility of the Formula Bar and Headers at runtime by using the following property and method. Formula Bar visibility: You can change this by setting FormulaBarVisibility property of SfSpreadsheet. Spreadsheet.FormulaBarVisibility = Visibility.Collapsed;Headers visibility You can change this by calling the SetRowColumnHeadersVisibility method of Spreadsheet. Spreadsheet.SetRowColumnHeadersVisibility(false);The following screenshot illustrates the Spreadsheet after collapse visibility of Formula Bar and Headers.   Samples:   WPF WinRT WinForms UWPConclusionI hope you enjoyed learning about how to change visibility of Formula Bar headers in WinForms SfSpreadsheet.You can refer to our WinForms SpreadSheet feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!  
How to change the visibility of Formula Bar and Headers at runtime in UWP Spreadsheet?
Sfspreadsheet allows you to change the visibility of Formula bar and Headers at run time.   Formula Bar visibility  You can change this by setting FormulaBarVisibility property of UWP Spreadsheet.   C# Spreadsheet.FormulaBarVisibility = Visibility.Collapsed;   Headers visibility You can change this by calling the SetRowColumnHeadersVisibility method of SfSpreadsheet.   C# Spreadsheet.SetRowColumnHeadersVisibility(false);   The following screenshot illustrates the SfSpreadsheet after collapse visibility of Formula Bar and Headers.   Sample links:   WPF   WinRT   WinForms   UWPConclusionI hope you enjoyed learning about how to change the visibility of Formula Bar and Headers at runtime in UWP Spreadsheet.You can refer to our UWP Spreadsheet feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!    
How to change the visibility of Formula Bar and Headers at runtime in WPF Spreadsheet?
WPF Spreadsheet allows you to change the visibility of Formula bar and Headers at run time.   Formula Bar visibility  You can change this by setting FormulaBarVisibility property of SfSpreadsheet.   C# Spreadsheet.FormulaBarVisibility = Visibility.Collapsed;   Headers visibility You can change this by calling the SetRowColumnHeadersVisibility method of SfSpreadsheet.   C# Spreadsheet.SetRowColumnHeadersVisibility(false);   The following screenshot illustrates the SfSpreadsheet after collapse visibility of Formula Bar and Headers.   Sample links:   WPF   WinRT   WinForms   UWPConclusionI hope you enjoyed learning about how to change the visibility of Formula Bar and Headers at runtime.You can refer to our WPF Spreadsheet feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF Spreadsheet example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!    
How to change the visibility of Formula Bar and Headers at runtime in WinRT Spreadsheet?
Sfspreadsheet allows you to change the visibility of Formula bar and Headers at run time.   Formula Bar visibility  You can change this by setting FormulaBarVisibility property of SfSpreadsheet.   C# Spreadsheet.FormulaBarVisibility = Visibility.Collapsed;   Headers visibility You can change this by calling the SetRowColumnHeadersVisibility method of SfSpreadsheet.   C# Spreadsheet.SetRowColumnHeadersVisibility(false);   The following screenshot illustrates the SfSpreadsheet after collapse visibility of Formula Bar and Headers.   Sample links:   WPF   WinRT   WinForms   UWP    
How to send custom headers to server using DataManager in.NET WebForms Grid ?
You can pass any values in the Headers of ejDataManager and retrieve them at the server-side using the Request object of the HttpRequestMessage. This can be added to the headers either in the initial load of ejGrid or while performing any server-side operations like editing/adding and retrieve them at the server-side as follows.     <div id="Grid"></div>       $("#Grid").ejGrid({         dataSource: ej.DataManager({ url: "/Home/DataSource", adaptor: new ej.UrlAdaptor() }),         allowScrolling: true,         allowFiltering: true,         allowPaging: true,         load: "load",         columns: [                   { field: "OrderID" },                 { field: "ShipCountry" },                 { field: "CustomerID" },                 { field: "EmployeeID" },                 { field: "ShipCity" }         ]     });   At the load event of Grid, we have to add some values to the headers of DataManager instances. MVC @(Html.EJ().Grid<OrdersView>("Grid")         .Datasource(ds=>ds.URL("/Home/DataSource").Adaptor(AdaptorType.UrlAdaptor))         .AllowPaging()         .Columns(col =>         {             col.Field("OrderID").Add();             col.Field("ShipCountry").Add();             col.Field("CustomerID").Add();             col.Field("EmployeeID").Add();             col.Field("ShipCity").Add();         })             .ClientSideEvents(events => events.Load("load")) )   Controller         public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm)         {             IEnumerable Data = new NorthwindDataContext().OrdersViews.ToList();             var Field = Request.Headers.GetValues("field").ToList()[0];             var Valid = Request.Headers.GetValues("IsValid").ToList()[0];             DataResult result = new DataResult();             DataOperations operation = new DataOperations();             result.count = Data.AsQueryable().Count();             if (dm.Skip != null)                 Data = operation.PerformSkip(Data, dm.Skip);             if(dm.Take != null)                 Data = operation.PerformTake(Data, dm.Take);             result.result = Data;             return Json(result, JsonRequestBehavior.AllowGet);         }   ASPX     <ej:Grid id="Grid" runat="server" AllowPaging="true">         <DataManager URL="Default.aspx/Data" Adaptor="WebMethodAdaptor" />         <Columns>                 <ej:Column Field="OrderID" />                 <ej:Column Field="ShipCountry" />                 <ej:Column Field="CustomerID" />                 <ej:Column Field="EmployeeID" />                 <ej:Column Field="ShipCity" />         </Columns>         <ClientSideEvents Load="load" />     </ej:Grid>   CodeBehind   In static methods, we cannot get the HttpRequest instance, so we have used the HttpContext.           [WebMethod]         [ScriptMethod(ResponseFormat = ResponseFormat.Json)]         public static object Data(Syncfusion.JavaScript.DataManager value)         {             var Field = HttpContext.Current.Request.Headers.GetValues("field").ToList()[0];             var Valid = HttpContext.Current.Request.Headers.GetValues("IsValid").ToList()[0];             IEnumerable Data = OrderRepository.GetAllRecords();             int count = Data.AsQueryable().Count();             DataOperations operation = new DataOperations();             Data = operation.Execute(Data, value);             return new { result = Data, count = count };           }   <script>     function load(args) {         //At the initial load of Grid, header is undefined         this.model.dataSource.dataSource.headers = [];//So define them as array         this.model.dataSource.dataSource.headers.push({ "field": "OrderID"});//pushing Some JSON Object         this.model.dataSource.dataSource.headers.push({ "IsValid": true });//pushing Some JSON Object     }  </script> Below screenshot shows the header values in the post request. Figure 1: Header values in Post Request     Figure 2: Grid  Conclusion I hope you enjoyed learning about howto send custom headers to server using DataManager in.NET WebForms Grid.You can refer to our .NET WebForms Grid feature tourpage to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our .NET WebForms Grid example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to send custom headers to server using DataManager in .NET MVC Grid ?
You can pass any values in the Headers of ejDataManager and retrieve them at the server-side using the Request object of the HttpRequestMessage. This can be added to the headers either in the initial load of ejGrid or while performing any server-side operations like editing/adding and retrieve them at the server-side as follows.     <div id="Grid"></div>       $("#Grid").ejGrid({         dataSource: ej.DataManager({ url: "/Home/DataSource", adaptor: new ej.UrlAdaptor() }),         allowScrolling: true,         allowFiltering: true,         allowPaging: true,         load: "load",         columns: [                   { field: "OrderID" },                 { field: "ShipCountry" },                 { field: "CustomerID" },                 { field: "EmployeeID" },                 { field: "ShipCity" }         ]     });   At the load event of Grid, we have to add some values to the headers of DataManager instances. MVC @(Html.EJ().Grid<OrdersView>("Grid")         .Datasource(ds=>ds.URL("/Home/DataSource").Adaptor(AdaptorType.UrlAdaptor))         .AllowPaging()         .Columns(col =>         {             col.Field("OrderID").Add();             col.Field("ShipCountry").Add();             col.Field("CustomerID").Add();             col.Field("EmployeeID").Add();             col.Field("ShipCity").Add();         })             .ClientSideEvents(events => events.Load("load")) )   Controller         public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm)         {             IEnumerable Data = new NorthwindDataContext().OrdersViews.ToList();             var Field = Request.Headers.GetValues("field").ToList()[0];             var Valid = Request.Headers.GetValues("IsValid").ToList()[0];             DataResult result = new DataResult();             DataOperations operation = new DataOperations();             result.count = Data.AsQueryable().Count();             if (dm.Skip != null)                 Data = operation.PerformSkip(Data, dm.Skip);             if(dm.Take != null)                 Data = operation.PerformTake(Data, dm.Take);             result.result = Data;             return Json(result, JsonRequestBehavior.AllowGet);         }   ASPX     <ej:Grid id="Grid" runat="server" AllowPaging="true">         <DataManager URL="Default.aspx/Data" Adaptor="WebMethodAdaptor" />         <Columns>                 <ej:Column Field="OrderID" />                 <ej:Column Field="ShipCountry" />                 <ej:Column Field="CustomerID" />                 <ej:Column Field="EmployeeID" />                 <ej:Column Field="ShipCity" />         </Columns>         <ClientSideEvents Load="load" />     </ej:Grid>   CodeBehind   In static methods, we cannot get the HttpRequest instance, so we have used the HttpContext.           [WebMethod]         [ScriptMethod(ResponseFormat = ResponseFormat.Json)]         public static object Data(Syncfusion.JavaScript.DataManager value)         {             var Field = HttpContext.Current.Request.Headers.GetValues("field").ToList()[0];             var Valid = HttpContext.Current.Request.Headers.GetValues("IsValid").ToList()[0];             IEnumerable Data = OrderRepository.GetAllRecords();             int count = Data.AsQueryable().Count();             DataOperations operation = new DataOperations();             Data = operation.Execute(Data, value);             return new { result = Data, count = count };           }   <script>     function load(args) {         //At the initial load of Grid, header is undefined         this.model.dataSource.dataSource.headers = [];//So define them as array         this.model.dataSource.dataSource.headers.push({ "field": "OrderID"});//pushing Some JSON Object         this.model.dataSource.dataSource.headers.push({ "IsValid": true });//pushing Some JSON Object     }  </script> Below screenshot shows the header values in the post request. Figure 1: Header values in Post Request     Figure 2: Grid  Conclusion I hope you enjoyed learning about how to send custom headers to server using DataManager in .NET MVC Grid.You can refer to our .NET MVC Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our .NET MVC Grid  example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to send custom headers to server using DataManager in .NET WebForms ?
You can pass any values in the Headers of ejDataManager and retrieve them at the server-side using the Request object of the HttpRequestMessage. This can be added to the headers either in the initial load of ejGrid or while performing any server-side operations like editing/adding and retrieve them at the server-side as follows.     <div id="Grid"></div>       $("#Grid").ejGrid({         dataSource: ej.DataManager({ url: "/Home/DataSource", adaptor: new ej.UrlAdaptor() }),         allowScrolling: true,         allowFiltering: true,         allowPaging: true,         load: "load",         columns: [                   { field: "OrderID" },                 { field: "ShipCountry" },                 { field: "CustomerID" },                 { field: "EmployeeID" },                 { field: "ShipCity" }         ]     });   At the load event of Grid, we have to add some values to the headers of DataManager instances. MVC @(Html.EJ().Grid<OrdersView>("Grid")         .Datasource(ds=>ds.URL("/Home/DataSource").Adaptor(AdaptorType.UrlAdaptor))         .AllowPaging()         .Columns(col =>         {             col.Field("OrderID").Add();             col.Field("ShipCountry").Add();             col.Field("CustomerID").Add();             col.Field("EmployeeID").Add();             col.Field("ShipCity").Add();         })             .ClientSideEvents(events => events.Load("load")) )   Controller         public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm)         {             IEnumerable Data = new NorthwindDataContext().OrdersViews.ToList();             var Field = Request.Headers.GetValues("field").ToList()[0];             var Valid = Request.Headers.GetValues("IsValid").ToList()[0];             DataResult result = new DataResult();             DataOperations operation = new DataOperations();             result.count = Data.AsQueryable().Count();             if (dm.Skip != null)                 Data = operation.PerformSkip(Data, dm.Skip);             if(dm.Take != null)                 Data = operation.PerformTake(Data, dm.Take);             result.result = Data;             return Json(result, JsonRequestBehavior.AllowGet);         }   ASPX     <ej:Grid id="Grid" runat="server" AllowPaging="true">         <DataManager URL="Default.aspx/Data" Adaptor="WebMethodAdaptor" />         <Columns>                 <ej:Column Field="OrderID" />                 <ej:Column Field="ShipCountry" />                 <ej:Column Field="CustomerID" />                 <ej:Column Field="EmployeeID" />                 <ej:Column Field="ShipCity" />         </Columns>         <ClientSideEvents Load="load" />     </ej:Grid>   CodeBehind   In static methods, we cannot get the HttpRequest instance, so we have used the HttpContext.           [WebMethod]         [ScriptMethod(ResponseFormat = ResponseFormat.Json)]         public static object Data(Syncfusion.JavaScript.DataManager value)         {             var Field = HttpContext.Current.Request.Headers.GetValues("field").ToList()[0];             var Valid = HttpContext.Current.Request.Headers.GetValues("IsValid").ToList()[0];             IEnumerable Data = OrderRepository.GetAllRecords();             int count = Data.AsQueryable().Count();             DataOperations operation = new DataOperations();             Data = operation.Execute(Data, value);             return new { result = Data, count = count };           }   <script>     function load(args) {         //At the initial load of Grid, header is undefined         this.model.dataSource.dataSource.headers = [];//So define them as array         this.model.dataSource.dataSource.headers.push({ "field": "OrderID"});//pushing Some JSON Object         this.model.dataSource.dataSource.headers.push({ "IsValid": true });//pushing Some JSON Object     }  </script> Below screenshot shows the header values in the post request. Figure 1: Header values in Post Request     Figure 2: Grid  
How to send custom headers to server using DataManager in LightSwitch HTML ?
You can pass any values in the Headers of ejDataManager and retrieve them at the server-side using the Request object of the HttpRequestMessage. This can be added to the headers either in the initial load of ejGrid or while performing any server-side operations like editing/adding and retrieve them at the server-side as follows.     <div id="Grid"></div>       $("#Grid").ejGrid({         dataSource: ej.DataManager({ url: "/Home/DataSource", adaptor: new ej.UrlAdaptor() }),         allowScrolling: true,         allowFiltering: true,         allowPaging: true,         load: "load",         columns: [                   { field: "OrderID" },                 { field: "ShipCountry" },                 { field: "CustomerID" },                 { field: "EmployeeID" },                 { field: "ShipCity" }         ]     });   At the load event of Grid, we have to add some values to the headers of DataManager instances. MVC @(Html.EJ().Grid<OrdersView>("Grid")         .Datasource(ds=>ds.URL("/Home/DataSource").Adaptor(AdaptorType.UrlAdaptor))         .AllowPaging()         .Columns(col =>         {             col.Field("OrderID").Add();             col.Field("ShipCountry").Add();             col.Field("CustomerID").Add();             col.Field("EmployeeID").Add();             col.Field("ShipCity").Add();         })             .ClientSideEvents(events => events.Load("load")) )   Controller         public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm)         {             IEnumerable Data = new NorthwindDataContext().OrdersViews.ToList();             var Field = Request.Headers.GetValues("field").ToList()[0];             var Valid = Request.Headers.GetValues("IsValid").ToList()[0];             DataResult result = new DataResult();             DataOperations operation = new DataOperations();             result.count = Data.AsQueryable().Count();             if (dm.Skip != null)                 Data = operation.PerformSkip(Data, dm.Skip);             if(dm.Take != null)                 Data = operation.PerformTake(Data, dm.Take);             result.result = Data;             return Json(result, JsonRequestBehavior.AllowGet);         }   ASPX     <ej:Grid id="Grid" runat="server" AllowPaging="true">         <DataManager URL="Default.aspx/Data" Adaptor="WebMethodAdaptor" />         <Columns>                 <ej:Column Field="OrderID" />                 <ej:Column Field="ShipCountry" />                 <ej:Column Field="CustomerID" />                 <ej:Column Field="EmployeeID" />                 <ej:Column Field="ShipCity" />         </Columns>         <ClientSideEvents Load="load" />     </ej:Grid>   CodeBehind   In static methods, we cannot get the HttpRequest instance, so we have used the HttpContext.           [WebMethod]         [ScriptMethod(ResponseFormat = ResponseFormat.Json)]         public static object Data(Syncfusion.JavaScript.DataManager value)         {             var Field = HttpContext.Current.Request.Headers.GetValues("field").ToList()[0];             var Valid = HttpContext.Current.Request.Headers.GetValues("IsValid").ToList()[0];             IEnumerable Data = OrderRepository.GetAllRecords();             int count = Data.AsQueryable().Count();             DataOperations operation = new DataOperations();             Data = operation.Execute(Data, value);             return new { result = Data, count = count };           }   <script>     function load(args) {         //At the initial load of Grid, header is undefined         this.model.dataSource.dataSource.headers = [];//So define them as array         this.model.dataSource.dataSource.headers.push({ "field": "OrderID"});//pushing Some JSON Object         this.model.dataSource.dataSource.headers.push({ "IsValid": true });//pushing Some JSON Object     }  </script> Below screenshot shows the header values in the post request. Figure 1: Header values in Post Request     Figure 2: Grid  
How to send custom headers to server using DataManager in .NET MVC?
You can pass any values in the Headers of ejDataManager and retrieve them at the server-side using the Request object of the HttpRequestMessage. This can be added to the headers either in the initial load of ejGrid or while performing any server-side operations like editing/adding and retrieve them at the server-side as follows.     <div id="Grid"></div>       $("#Grid").ejGrid({         dataSource: ej.DataManager({ url: "/Home/DataSource", adaptor: new ej.UrlAdaptor() }),         allowScrolling: true,         allowFiltering: true,         allowPaging: true,         load: "load",         columns: [                   { field: "OrderID" },                 { field: "ShipCountry" },                 { field: "CustomerID" },                 { field: "EmployeeID" },                 { field: "ShipCity" }         ]     });   At the load event of Grid, we have to add some values to the headers of DataManager instances. MVC @(Html.EJ().Grid<OrdersView>("Grid")         .Datasource(ds=>ds.URL("/Home/DataSource").Adaptor(AdaptorType.UrlAdaptor))         .AllowPaging()         .Columns(col =>         {             col.Field("OrderID").Add();             col.Field("ShipCountry").Add();             col.Field("CustomerID").Add();             col.Field("EmployeeID").Add();             col.Field("ShipCity").Add();         })             .ClientSideEvents(events => events.Load("load")) )   Controller         public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm)         {             IEnumerable Data = new NorthwindDataContext().OrdersViews.ToList();             var Field = Request.Headers.GetValues("field").ToList()[0];             var Valid = Request.Headers.GetValues("IsValid").ToList()[0];             DataResult result = new DataResult();             DataOperations operation = new DataOperations();             result.count = Data.AsQueryable().Count();             if (dm.Skip != null)                 Data = operation.PerformSkip(Data, dm.Skip);             if(dm.Take != null)                 Data = operation.PerformTake(Data, dm.Take);             result.result = Data;             return Json(result, JsonRequestBehavior.AllowGet);         }   ASPX     <ej:Grid id="Grid" runat="server" AllowPaging="true">         <DataManager URL="Default.aspx/Data" Adaptor="WebMethodAdaptor" />         <Columns>                 <ej:Column Field="OrderID" />                 <ej:Column Field="ShipCountry" />                 <ej:Column Field="CustomerID" />                 <ej:Column Field="EmployeeID" />                 <ej:Column Field="ShipCity" />         </Columns>         <ClientSideEvents Load="load" />     </ej:Grid>   CodeBehind   In static methods, we cannot get the HttpRequest instance, so we have used the HttpContext.           [WebMethod]         [ScriptMethod(ResponseFormat = ResponseFormat.Json)]         public static object Data(Syncfusion.JavaScript.DataManager value)         {             var Field = HttpContext.Current.Request.Headers.GetValues("field").ToList()[0];             var Valid = HttpContext.Current.Request.Headers.GetValues("IsValid").ToList()[0];             IEnumerable Data = OrderRepository.GetAllRecords();             int count = Data.AsQueryable().Count();             DataOperations operation = new DataOperations();             Data = operation.Execute(Data, value);             return new { result = Data, count = count };           }   <script>     function load(args) {         //At the initial load of Grid, header is undefined         this.model.dataSource.dataSource.headers = [];//So define them as array         this.model.dataSource.dataSource.headers.push({ "field": "OrderID"});//pushing Some JSON Object         this.model.dataSource.dataSource.headers.push({ "IsValid": true });//pushing Some JSON Object     }  </script> Below screenshot shows the header values in the post request. Figure 1: Header values in Post Request     Figure 2: Grid  ConclusionI hope you enjoyed learning about how to send custom headers to server using DataManager in .NET MVC.You can refer to our ASP.NET MVC feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET MVC example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to add WinForms XlsIO headers and footers in C#, VB.NET?
Syncfusion&reg; Excel (XlsIO) library is a .NET Excel library used to create, read, and edit Excel documents. It also converts Excel documents to PDF files. Using this library, you can add Excel headers and footers in C# and VB.NET on our WinForms XlsIO feature tour page. What are headers and footers in Excel? Header in Excel It is a section of the worksheet that appears at the top of each page in the Excel worksheet. The header remains constant across all the pages. Footer in Excel It is a section of the worksheet that appears at the bottom of each page in the Excel worksheet. The footer remains constant across all the pages. Purpose of headers and footers in Excel You can include a header or footer on each page of your worksheet to make your printed Excel documents look more stylish and professional. Generally, headers or footers contain basic information about the spreadsheet, such as page number, current date, workbook name, file path, etc. Headers or footers can be displayed only on printed pages, in Print Preview and Page Layout view. In the normal worksheet view, they are not visible. Steps to add Excel headers and footers, programmatically: Step 1: Create a new C# console application project. Create a new C# console application Step 2: Install the Syncfusion.XlsIO.WinForms NuGet package as reference to your .NET Framework application from NuGet.org. Install NuGet package Step 3: Include the following namespace in the Program.cs file. C# using Syncfusion.XlsIO;   VB.NET Imports Syncfusion.XlsIO   Step 4: Use the following code snippet to add Excel headers and footers in C#, VB.NET. C# using (ExcelEngine excelEngine = new ExcelEngine()) {     // Instantiate the application object     IApplication application = excelEngine.Excel;       // Open a sample workbook     IWorkbook workbook = excelEngine.Excel.Workbooks.Open(@"../../Data/Sample.xlsx");                     // The first worksheet object in the worksheets collection is accessed     IWorksheet worksheet = workbook.Worksheets[0];                 // Create headers     // Add page headers with page number, current time and current date     worksheet.PageSetup.CenterHeader = "&P";     worksheet.PageSetup.LeftHeader = "&T";     worksheet.PageSetup.RightHeader = "&D";                     // Create footers     // Add page footers with name of the document, name of the workbook tab and file path     worksheet.PageSetup.CenterFooter = "&F";                    worksheet.PageSetup.LeftFooter = "&A";     worksheet.PageSetup.RightFooter = "&Z";                     // Save the file     workbook.SaveAs("D://temp/Output.xlsx"); }   VB.NET Using excelEngine As ExcelEngine = New ExcelEngine()     'Instantiate the application object     Dim application As IApplication = excelEngine.Excel       'Open a sample workbook     Dim workbook As IWorkbook = excelEngine.Excel.Workbooks.Open("../../Data/Sample.xlsx")       'The first worksheet object in the worksheets collection is accessed     Dim sheet As IWorksheet = workbook.Worksheets(0)       'Create headers     'Add page headers with page number, current time and current date     sheet.PageSetup.CenterHeader = "&P"     sheet.PageSetup.LeftHeader = "&T"     sheet.PageSetup.RightHeader = "&D"       'Create footers     'Add page footers with name of the document, name of the workbook tab and file path     sheet.PageSetup.CenterFooter = "&F"     sheet.PageSetup.LeftFooter = "&A"     sheet.PageSetup.RightFooter = "&Z"       'Save the file     workbook.SaveAs("Output.xlsx") End Using   Strings that the header or footer takes are script commands used to set header or footer formatting. For more information on formatting the string, see Inserting and Formatting Text in Headers and Footers. A complete Windows Forms working example of how to add Excel headers and footers in C# and VB.NET can be downloaded from Add Excel Headers And Footers.zip. By executing the program, you will get the output Excel file as shown below. Output Excel document Refer here to explore the rich set of Syncfusion&reg; Excel (XlsIO) library features. See Also: Add image to Excel header in C#, VB.NET How do I keep the headers visible while scrolling down through data? Can we set font color for Footer through XlsIO? How to get column names of a named range with column headers in C#, VB.NET? How to set Freeze panes in Excel using C#, VB.NET? Take a moment to peruse the documentation where you can find basic Excel document processing options along with the features like import and export data, chart, formulas, conditional formatting, data validation, tables, pivot tables and protect the Excel documents, and most importantly, the PDF, CSV and Image conversions with code examples.Note:Starting with v16.2.0.x, if you reference Syncfusion&reg; assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to the link to learn about generating and registering the Syncfusion&reg; license key in your application to use the components without a trial message.ConclusionI hope you enjoyed learning about how to add WinForms XlsIO headers and footers in C# and VB.NET.You can refer to our XIsIO’s feature tour page to learn about its other groundbreaking features. Explore our UG documentation and online demos to understand how to manipulate data in Excel documents.If you are an existing user, you can access our latest components from the License and Downloads page. For new users, you can try our 30-day free trial to check out XlsIO and other Syncfusion&reg; components.If you have any queries or require clarification, please let us know in the comments below or contact us through our support forums, Support Tickets, or feedback portal. We are always happy to assist you!  
No articles found
No articles found
1 of 1 pages (14 items)