Monday, January 27, 2014

ASP.NET 4.0 ClientModID


We can use control ID in script (insiede html page or js file) without using ClientID clause

like we have
<asp:textbox  id="txtID"  runat="server" text="0"></asp:textbox>
in order to get its value in script we need to write

'<%= txtID.ClientID %>'
 to manipulate its value , but now we can set ClientIDMode property to access controls just like we access html controls in script

<asp:textbox clientidmode="Static" id="txtID"  runat="server" text="0"></asp:textbox>

we can access its value in script

('@txtID').val();



http://weblogs.asp.net/asptest/archive/2009/01/06/asp-net-4-0-clientid-overview.aspx
http://stackoverflow.com/questions/5666011/retrieve-id-of-server-control-using-jquery

Thursday, January 23, 2014

Validate an XML File

http://www.xmlvalidation.com/

Window btoa() Method

http://www.w3schools.com/jsref/met_win_btoa.asp

SqlCommand.CommandTimeout Property




With SqlCommand.CommandTimeout property we can set times in seconds to wait for the command to execute. The default is 30 seconds

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx 
http://stackoverflow.com/questions/7023740/sqlcommand-object-what-length-of-time-for-commandtimeout 

How To Use HTML Code Inside Blog Post In Blogger


http://www.ebloglive.com/2012/06/how-to-use-html-code-inside-blog-post.html

Online Html encoding/decoding

http://htmlentities.net/

Wcf-The maximum message size quota for incoming messages (65536) has been exceeded?

Set following parameters in your web.config

<bindings>
      <basicHttpBinding>
        <binding name="bindingName" maxBufferSize="2147483647"
         maxBufferPoolSize="2147483647"
         maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647"
                  maxStringContentLength="2147483647"
                  maxArrayLength="2147483647"
                  maxBytesPerRead="2147483647"
                  maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IApiService" />
        <binding name="WSHttpBinding_IApiService1" />
      </wsHttpBinding>
    </bindings>


http://stackoverflow.com/questions/19564047/wcf-the-maximum-message-size-quota-for-incoming-messages-65536-has-been-exceed

Comapare Date in Linq to Sql



I had the requirement to compare Date in Linq to Sql, i have 2 option to use :
in one case i can use myDate.Date it will also return date part with 12:00:00 AM time string too. To get only date part we need to use
date_modified1.Date > modified_date2.Date // retunrn date part + 12:00:00 AM

EntityFunctions.TruncateTime(date_modified1)>
EntityFunctions.TruncateTime(modified_date2) return Date part only

http://stackoverflow.com/questions/10647360/linq-to-sql-to-search-only-date-portions-of-a-date

Pass DateTime in WCF XML Request



To pass datetime valu in wcf XML Request we need to change date in YYYY-MM-DDThh:mm:ss format.


Example : DateTime.Now.ToString("yyyy-MM-dd'T'HH:mm:ss.fffffffZ")

http://stackoverflow.com/questions/254753/what-is-the-correct-format-to-use-for-date-time-in-an-xml-file
http://www.w3schools.com/schema/schema_dtypes_date.asp

Tuesday, January 21, 2014

Enable MVC Add View to Orchard Project


1. Select the Porject you want to enable mvc
2. Right Click and Select Unload Project
3. Right Click Unloaded Project file and click Edit Project File
4. Search for  ProjectTypeGuids and add following guid to enable mvc projects
 {E53F8FEA-EAE0-44A6-8774-FFD645390401};


{E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}

http://ericphan.net/blog/2011/1/22/tip-enable-mvc-3-add-view-to-orchard-code-generated-module-p.html

Monday, January 20, 2014

Orchard Commands to generate code

To open Orchard command line tool
Go to Orchard.Web > bin > Run Orchard.exe

1. Theme scaffolding

     - codegen theme SampleSite /CreateProject:true
      - codegen theme MyFirstTheme

SampleISite : New Theme project
use second command if you want to generate theme in existing Theme project of orchard source code

Orchard - Command line scaffolding


Code generation is an Orchard module that automates the task of creating additional files and extensions. This feature is useful for developers that want to create controllers, data migration classes, modules, and themes. However, the code generation feature is not installed by default when you install Orchard.

Enable it via command line


feature enable Orchard.CodeGeneration


http://docs.orchardproject.net/Documentation/Command-line-scaffolding


Pop up to ask user before leaving a page if there are unsaved chnages.

Here is the good article to implement this functionality but i was unable to do this with post back buttons in share point web part, it broke all subsequent post backs on page if user clicks "Stay on page", for Hypelinks it works perfectly. I used javascript confirm for postback buttons.

http://snippets.surfthru.com/post/Check-For-Unsaved-Changes-Before-Leaving-a-Page.aspx