For a website URL which contains characters which will be interpreted incorrectly by browsers this needs to be escaped. URLEncode is used to protect the URL, for example for use in XML, or passing parameters within a querystring. System.Web.HttpUtility.UrlEncode(link) I have found the error object reference not set to an instance of an object. To […]
Category: VB.NET
Reading and Writing Cookies
Sometimes using viewstate and hidden form fields are just not enough to be able to control the actions and views of our website visitors. As an alternative to viewstate and hidden form fields we may wish to make use of cookies. Cookies are, typically, short pieces of information stored on a users computer. To handle cookies […]
Reference a Dynamically Created Control
Wishing to reference an asp.net control (vb.net or c#) in JavaScript or jQuery how can I do this given that the ID is dynamically created? I can’t just write var fruitName = document.getElementById(‘tbxName’); Or the jQuery equivalent of Var fruitName = jQuery(‘#tbxName’); Each asp.net control added to the page is assigned a unique reference ID […]
Capturing Textbox Enter Key Press Form Submission
I had created a DNN module with a TextBbox and LinkButton submission. The result was to retrieve the set of results and populate a DataGrid. Textbox was to be used to filter the results. All somewhat typical. The client had asked for the pressing of the Enter key to be supported, rather than clicking on […]
Read More… from Capturing Textbox Enter Key Press Form Submission
SQL Entries Matching End Date not Selected
Extending an SQL select with date bounds I found that the end date wasn’t including the given date, rather only entries upto the day before were being selected. […]
Test if Item Selected in ListBox
Testing to ensure that a ListBox has a selected item on submit. Here all is done using the built in asp.net functions. Alternatively, could use JavaScript or JQuery. Note that to do so would need to assign variables to the listbox element for the testing. 1. Field Validator Here’s the list box with its items. […]
Disable ASP.NET Form Button
When providing buttons on a web page, we may wish to show a particular button as ‘greyed out’, signifying that it is more generally available for use, but not for the task we are undertaking. An example of this would be an edit button. If the content we are adding (perhaps the details for a […]
Formatting Datagrid Data Text Two Ways
Data grid output can be formatted differently for the public/normal view and the edit view. In this example both methods are used. Using inline table row editing with a DataGrid I wished to change the formatting according to its state. To illustrate this I have included below an example template column. <HEADERSTYLE HorizontalAlign=”Center”></HEADERSTYLE> <ITEMTEMPLATE> <asp:Label […]
Add Browser Redirection to ASP.NET File
Perhaps a page was created with a spelling error, or a reorganisation of the website means that a particular page has been renamed. We wish to redirect our visitors to the page to a different address. In the example below its assumed that the website page has moved to www.example.com/fruit-and-veg/. We wish to tell the […]
CustomValidator with Client JavaScript
I had crafted a custom validator for an DNN asp.net web page with a function to validate form elements. Using the DNN pop-up calendar, with appropriate date formatting according to the browser, had issues with visitors not setting the language within the browser correctly. It was also decided that using 3 dropdownlists would provide a […]


