Posts

Showing posts from December, 2019

Import Data From Excel file into Sql Server

Image
First, Create or select Database and right-click on the database name, then select Tasks-> Import Data as shown below Then, Below Screen Shows up Click on Next, Here, from data source dropdown select Microsoft Excel as we are importing data from excel file Then below screen shows up, Here we need to choose the excel file and select the excel version and click on next. Then below screen shows up, Here we need to choose the destination where we need to insert the data. In my case, I am trying to insert it into the local database so I am selecting SQL Server Native Client 11.0 and select the authentication mode and select the database where you want to insert as shown below and click on next. Then below screen shows up, Click on next, then below screen shows up Here You can change the table name if you want or else click on next, Select Run Immediately, then click on next then the data will be inserted into the selected database.

How to return only Json response from webapi method using c#?

Paste the below code in WebApiConfig.cs file, config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json")); config.Formatters.Remove(config.Formatters.XmlFormatter);

Implement Azure Ad Authentication In webapi c#

Install-Package Microsoft.AspNet.WebApi Install-Package Microsoft.AspNet.WebApi.Owin Install-Package Microsoft.Owin.Host.SystemWeb Install-Package Microsoft.Owin.Security.ActiveDirectory Install-Package Microsoft.Net.Http Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory

How to get row data in kendo grid when button is clicked

Let us consider their is a edit button in kendo  grid as shown below ex:           {                     command: [{                         name: "edit",                         className: "btn-Edit",                         text: "Edit", click: btnEdit                     }], title: "Action", media: "(min-width: 500px)", width: "220px"                 } Now In btnEdit() function we get the button clicked row data using jquery as shown, ex:      function btnEdit(e) {             var grid = $("#gridName").getKendoGrid();             var item = grid.d...

How to add button in kendo grid using jquery

Below code can be used to add a button in kendo grid.  ex:           {                     command: [{                         name: "edit",                         className: "btn-Edit",                         text: "Edit", click: btnEdit                     }], title: "Action", media: "(min-width: 500px)", width: "220px"                 } In the above code, className :- Defines the css class name text :- Text displayed on button click :- Function to be called when clicked on button title:- Text displayed as grid column header In this example we are calling btnEdit function on clicked, function b...

How to show loading effect in kendo grid using jquery

The below line can be used to show the loading effect for your grid,  kendo.ui.progress($("#YourGridId"), true); To stop the loading effect you can use the below line  kendo.ui.progress($("#YourGridId"), false);

How to select default value on loading dynamic kendo dropdownlist

//calling the below function to get the weekendingdates from database using ajax call ex:  function GetWeekEndingDates() {             $.ajax({                 type: 'GET',                 url: "WS_Equipment.asmx/GetWeekendingDate",                 dataType: "json",                 success: function (jsonData) {                     var i = JSON.parse(JSON.stringify(jsonData));                     if (jsonData != null) {                         WeekDates = i.WeekEndingDates;                         LastWeekDate = i.LastWeekEndingDate;         ...

How to retrieve json parameters from postman in webapi?

If we send parameters in text format we can make use of the following code and convert it into a class object . In your method copy the following code,                   1.var json = await Request.Content.ReadAsStringAsync();                       2. clsFeilds objJson = JsonConvert.DeserializeObject<clsFeilds>(json); In the above code stmt 1 retrieves the JSON parameters in JSON string format. In stmt 2 when we pass the JSON string it deserializes it to a class object. Note: To use the above code we need to make our method as '' ASYNC ". ex:         [HttpGet]         public async Task<string> multiple()         {             //        { "U...

How to show or bind dynamic data to kendo grid using jquery in mvc view,aspx?

    <script> $(document).ready(function () {             $("#ListViewGrid").kendoGrid({                 dataSource: {                     transport: {                         read: {                             url: 'WS_Equipment.asmx/ListView',                             dataType: 'json'                         }                     },                     schema: {                         model: {     ...

How to extract or retrieve parameter values from url using jQuery?

Let us consider the following sample Url, from which we want to extract the parameter values. window.location.href = "./EquipmentCostList.aspx?headerId=" + 123+"&WorkOrderNumber="+123+"&WeekEndindDate="+2019/08/12; If we see the above sample url we can find the parameters like headerId,WorkOrderNumber,etc.. So, to extract these parameter values from the url, we can easily write some jQuery code as shown below, jQuery Code : $(document).ready(function () { //below method is used to retrieve the single parameter value based the parameter name sent.             var getUrlParameter = function getUrlParameter(sParam) {                 var sPageURL = window.location.search.substring(1),                     sURLVariables = sPageURL.split('&'),                     sParameterName,           ...

How to Show multiple kendo grids using dynamic data in Html using Jquery

1.Declare a div element to bind the gird ex:   <div class="container-fluid">                <div id="Equipmentgrid"></div>          </div> 2. Get the data using ajax call ex: <script>         var EquipmentData;         var EmployeeDat;                 $.ajax({                     type: 'GET',                     url: "WS_Equipment.asmx/GetEquipmentData",                     data: { WeekendingDate: WeekendingDate, WorkOrderId: WorkOrderId },                     dataType: "json",                     success: function (jsonData) {    ...

How to bind remote data from DB to kendo dropdownlist using Jquery in C#

Let us consider the below example, Step 1 : Consider the below textbox for which we want to bind dropdownlist using kendo. Sample code : <div class="col-md-3">           <label for="validationServer01" style="color: #6f90a3">Week Ending Date</label>                                       <input id="products" style="width: 270px" />  </div> Step 2 : Let's write the Jquery script to get the dropdown list from webservice and bind it to input element  and initialize kendo dropdown. Sample code: <script>         $(document).ready(function () {             $("#products").kendoDropDownList({                 filter: "contains",                 optionLabel: "Select Week...