Adding simple pieces of JavaScript to an Asp.net page can be achieved by adding the attributes of the particular imagebutton or linkbutton, for example: imgUpdate.Attributes.Add(“onClick”, “return confirm(‘Please confirm the Credit Card has been swiped’);”) I had a requirement whereby I had a DataGrid with checkbox to signify if the particular row was selected. The number […]
Category: VB.NET
Unable to Find Script Library WebUIValidation.js
For an old DotNetNuke website I encountered the error: Unable to find script library ‘/aspnet_client/system_web/1_1_1_4322/WebUIValidation.js’ I ran the command Aspnet_regiis.exe which is located in the directory C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322. C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322/aspnet_regiis.exe -c The utility aspnet_regiis.exe is installed a a part of the .Net Framework. Using the utility allows the version of .Net Framework to be registered with IIS […]
Read More… from Unable to Find Script Library WebUIValidation.js
Current Date and Time Using Now
The DateTime property Now may also be used in VB.Net to get the current date and time. Assigning the current date and time to the variable startDate: Dim startDate as DateTime = DateTime.Now DateTime is found in the Namespace System. To make use of the DateTime functions the System namespace is referenced. this may either […]
Accessing web.config validationkey
Writing a piece of code which was to have an encryption peculiar to the site installation I chose to access the machineKey stored within the web.config file, storing it as a property value. Shown below is the section of the web.config file showing an example machineKey <system.web> <machineKey validationKey=”96EF5EC29SFC239FA2814446591DEBBEB11924AA” decryptionKey=”1DDCA139D9123897845660176C989D79B8BA908E90218F0D” decryption=”3DES” validation=”SHA1″ /> Assigning the […]
Checking if DateTime is not set
I had a DateTime property which when it hadn’t been set I wished to return the date for a number of years previous. My initial test was for an empty string, I then tried using a test to see if the value was nothing. The final version used a test for the DateTime MinValue. I […]
Unable to Write to Output File System Error &H80004005&
When I compiled a project in Visual Studio I had the following error: Unable to Write to Output File … System Error &H80004005& Its not an error message which one would associate with missing files. However, looking around on the Internet this is given as one of the options. Anther option is that another user […]
Read More… from Unable to Write to Output File System Error &H80004005&
An Alternative to string.isnullorempty
Updating an old module originally designed for ASP.NET 2 the test IsNullOrEmpty gave the error IsNullOrEmpty. The string test used was If Not String.IsNullOrEmpty(filterString) Then…End if And the error viewed was: ‘IsNullOrEmpty’ is not a member of ‘String’ An alternative to this test is to test for nothing, together with a test to ensure that the […]
Converting Text to Proper Case
For a title or persons name VB.NET and C# can convert the text to initial capital letters. For example, to convert the lower case name john smith to John Smith. VB.NET To implement the conversion of the name to initial word capital letters, ie Proper Case, is a simple function in VB.NET StrConv(UserName, VbStrConv.ProperCase) C# […]
Binding Datagrid to Access Database
Taken from an old project, an illustration of binding a DataGrid to an Access database. Sub BindDataGrid() Dim MyCommand As OleDbCommand Dim myConnection as OLEDBConnection Dim myDatareader as OLEDBDataReader Dim myAdapter as OLEDBDataAdapter Dim myDataSet As DataSet Dim sqlString As String myConnection = New oleDbConnection(“PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=”&server.mappath(“/myDatabase.mdb”)) sqlString = “SELECT * FROM myTable myAdapter = New […]
Server.Mappath Error
Historically I have used the Server.MapPath reference directly. However recently when implementing this I received the dreaded object reference not set to an instance of an object error. Below is the snippet of code Dim docSettings As String = HomeDirectory & “Settings.xml”If File.Exists(Server.MapPath(docSettings)) Then I found that I needed to use a fuller reference: HttpContext.Current.Server.MapPath(docSettings) […]


