How to add image in NPOI excel cell

by Girish21. February 2014 20:35

Here is the working solution for how to add image in NOPI excel cell Hope this will help you out.. Share and Learn... :)

ExportExcelWithImage.zip (6.17 mb)

Tags:

asp.net | c# | MVC 4 razor

Country Wise State List SQL script

by Girish21. February 2014 01:54

I come across a situation where I needed country wise state dropdown in my Website. Initially I though it would be real easy to find such script on internet. I tried to google it and come to know its not that easy that we think. Finally i found an mysql script and then converted it to MS SQL script. Hope this will help others without waste of time on google. Share and Learn :)

Country-Wise-State.sql (1.26 mb)

Tags:

Country list | MSSQL

How to compare two text files?

by Girish31. December 2013 12:08

Here is the attached code.

 

DiffEngine_src.zip (23.37 kb)

Tags:

c#

full calendar events not showing in firefox and internet explorer

by Girish24. September 2013 09:32

Recently i was working with fullcalendar.js for showing event on my website. I develop the page in chrome and then i run it in firefox and internet explorer and it did not load the events even it does not give any error and either of the browser. It was really difficult to track it down specially when you don't get error. I google it. Many people were having this problem.

Solution >> 

1. In JSON data key should be lower case as javascript is case sensitive, 

2. It cause because i included AM or PM in my date values.

3. Always pass the Json string of array object from code behind (You can see in below c# code)

But my case was different, In my case it was causing because the date format should have YYYY-MM-DD format, means 2013-12-11 is the correct date but if you have date like 2013-9-11 this will cause the fullcalendar to stop loading events, Strange but that is only causing it. So i formated the date.

 

Code:

$('#calendar').fullCalendar({

            editable: false,

            events: PageUrl + "/Calendar/GetAllEvents", // return the json data

            header: {

            left: 'prev,next today',

            center: 'title',

            right: 'month,agendaWeek,agendaDay'

            },

        eventClick: function (calEvent, jsEvent, view) {

        },

        eventRender: function (event, element) {

        },

        loading: function (bool) {

            if (bool) {

                Loader(true);

            }

            else {

                Loader(false);

            }

        }

    });

 

       /// <summary>

        /// Return all events to display on calendar

        /// </summary>

        /// <returns></returns>

        public string GetAllEvents()

        {

            List<Event> objEventList = new List<Event>();

            objEventList = manager.GetEvents();

            var EventsList = from m in objEventList

                             select new

                             {

                                 id = m.Item.ItemId.ToString(),

                                 eventid = m.EventId.ToString(),

                                 isexpired = ((m.EventEndDate < DateTime.Now) ? true : false).ToString(),

                                 title = m.EventName,

                                 start = m.EventStartDate.Year + "-" + string.Format("{0:00}", m.EventStartDate.Month) + "-" + string.Format("{0:00}", m.EventStartDate.Day),

                                 end = m.EventEndDate.Year + "-" + string.Format("{0:00}", m.EventEndDate.Month) + "-" + string.Format("{0:00}", m.EventEndDate.Day),

                                 backgroundColor = m.EventbackgroundColor,

                                 borderColor = m.EventborderColor,

                                 textColor = m.EventtextColor,

                                 url = "#loadme_" + m.EventId,

                                 description = BuildEventToolTip(m.Item.ItemId.ToString(), m.EventName, m.EventStartDate.ToShortDateString(), m.EventEndDate.ToShortDateString(), m.EventSeatLimit.ToString(), (m.EventSeatLimit - manager.CheckEventSeatAvailability(m.EventId)).ToString()),

                             };

            var jsonSerialiser = new JavaScriptSerializer();

            return jsonSerialiser.Serialize(EventsList);

        }

 You can see the string.Format("{0:00}", m.EventStartDate.Month)  i have used to make sure values <10 should be pad with 0

 

Hope this solve your problem... Share & Learn.... ;)

Tags:

Javascript | Jquery

how to create web method in asp.net and call it from javascript

by Girish23. August 2013 07:27

Step 1: Add script manager on page under form tag

<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" EnablePartialRendering="true" runat="server" />

Step 2: Create static method in any aspx.cs page where you want to create it with method attributes webmethod and scriptmethod as below.

 [WebMethod]

 [System.Web.Script.Services.ScriptMethod()] 

  public static int SaveUCCSVehicalReportNote(string strUpdateNote)

  {  return 1;            }

 

Step 3:  Call the webmethod in javascript

PageMethods.SaveUCCSVehicalReportNote(JSON.stringify(jsonObj), function (response) {

alert(response); // this will give you the data return from the method.

 

});

 

 

Tags:

asp.net | Javascript

unable to change quirks mode in internet explorer?

by Girish23. August 2013 07:24

Add <!DOCTYPE html> at very top of the page.

Note: There should not be any comment or space or line before this tag.
otherwise IE will set document mode to quirks mode.

Tags:

Elmah error log page 404 not found. axd file not accesible.

by Girish23. August 2013 07:24

Answer >>


<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <remove name="ScriptModule" />
      <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <remove name="ScriptHandlerFactory" />
      <remove name="ScriptHandlerFactoryAppServices" />
      <remove name="ScriptResource" />
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
           type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
           type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="elmah" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
    </handlers>
  </system.webServer>

Add above extra tags in web.config file and it will work fine.

Tags:

unable to change quirks mode in internet explorer?

by Girish23. August 2013 07:19

Add <!DOCTYPE html> at very top of the page.

Note: There should not be any comment or space or line before this tag.
otherwise IE will set document mode to quirks mode.

Tags:

Javascript

unable to change quirks mode in internet explorer?

by Girish23. August 2013 07:19

Add <!DOCTYPE html> at very top of the page.

Note: There should not be any comment or space or line before this tag.
otherwise IE will set document mode to quirks mode.

Tags:

Javascript

javascript trim() function not working in IE

by Girish23. August 2013 07:18

Answer >>

add below script on page to make it working...


if (typeof String.prototype.trim !== 'function') {
    String.prototype.trim = function () {
        return this.replace(/^\s+|\s+$/g, '');
    }
}

Tags:

Javascript

About Girish Kolte

.Net programmer

Calendar

<<  November 2014  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

View posts in large calendar

Month List