VB.NET

Trim numbers

Convert a string to currency

.Net Shortcuts

Date "" fails to insert in the database

Relative URL's to CSS and JavaScript not working when deployed to Acceptance.

Upgrading to Visual Studio 2015 from 2008: Some error I encountered and there resolution
  1. WebException Could not establish trust relationship for the SSL/TLS secure channel

  2. System.InvalidOperationException: WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).

_________________________________________________________________

Trim numbers 

Public Sub Main()
   'Declaring a variable to hold integer value
   Dim int as integer = "123456"
   'Convert the integer into string
   Dim str as string = int.ToString()
  'Displays last four numbers
  Console.WriteLine(str.Remove(0,2))
  'Displays first two numbers
  Console.Writeline(str.Remove(2))
 End Sub

Convert a string to currency

String.Format("{0:c}", Price)

.NET Shortcuts

Format document
Ctrl + K + D (Entire document)
Ctrl + K + F (Selection)

Date "" fails to insert in the database

Add this code to the function for inserting the data into the database:

.AddInParameter(cmdInsert, "@dtStateLicExpDate", DbType.Date, IIf(dtStateLicExpDate = "", DBNull.Value, dtStateLicExpDate))

WebException Could not establish trust relationship for the SSL/TLS secure channel

Add this to web config
In <system.web>
      <httpRuntime targetFramework="4.6" />

<pages controlRenderingCompatibilityVersion="3.5" masterPageFile="~/master/Dash.master" clientIDMode="AutoID"/>

System.InvalidOperationException: WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).

Add this key value
 <add key="ValidationSettings:UnobtrusiveValidationMode" value="none"/>

Relative URL's to CSS and JavaScript not working when deployed to Acceptance

Instead of dragging and dropping the link to the aspx page that need to use it
<script src="../../Jscripts/CommonFunctions.js"></script>

USE THIS
  <link rel="stylesheet" type="text/javascript" href="<%= ResolveUrl("~/Jscripts/CommonFunctions.js") %>"/>


















No comments:

Post a Comment