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

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

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

Determine Subroutine Click Event Trigger

Using one sub-routine to handle more than one link button click event requires determination of which button click triggered the sub-routine. I had an existing subroutine handling a link button. Examining the entries in a form, updating a database and sending an email. A second button was required on the […]

Converting to and from ASCII with vb.net

The ASCII table is a representation of the Roman characters as numeric values. Given an ASCII value we may wish to convert it to its corresponding character, or indeed back the other way from character to ASCII value. To convert an integer variable of ASCII value, myASCII, to a string […]

Convert Textbox String to Double

The task is to take user entered textbox content, converting it to a field of type double. As a part of a form I had a numeric entry field. The string value entered in this textbox to be converted to type double for saving in a database. The public view […]

LinkButton Handles OnClick Equivelent in C#

To handle a Linkbutton onclick in VB.NET the LinkButton is declared and a handler sub declared: <asp:linkbutton id=”cmdAdd” runat=”server” ResourceKey=”Add” BorderStyle=”none” CausesValidation=”true” /> Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click ::: ::: End Sub C# doesn’t support the VB.net handles on click, the function is […]

Add an Edit Button to a DataGrid

The DataGrid configuration includes an editColumn, allowing inline editing of the row. An edit button can be added to a DataGrid using the editColumn feature. With the addition of the edit column, links are added to handle the usual actions of edit, update and delete. Associated with the editColumn components […]