Using JavaScript with Form Elements

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 […]

Read More… from Using JavaScript with Form Elements

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

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 […]

Read More… from Accessing web.config validationkey

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 […]

Read More… from Binding Datagrid to Access Database

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) […]

Read More… from Server.Mappath Error