ASP dot NET

Code snippets for ASP.NET pages. Some code snippets may have a programming language associated with it. The programming lanuage will reside in the script tags where applicable. All the page code will be provided to illustrate the example. Read the entire article prior to trying it yourself in case the need to import libraries or make other configurations in your development environment is necessary.

After filling in your dataset with your data adapter, you probably want to transfer that information to a DataTable so that you can display it on a your page's datagrid, use it in an export to .csv function or something to that nature. However during compile time you may receive the following error:

Non-invocable member 'System.Data.DataSet.Tables' cannot be used like a method

One of the reasons you may be receiving this error is due to the way you have the DataTable name enclosed.  It should be in brackets instead of parenthesis.

The example below illustrates how to bind values to a data list.   You should be able to copy and paste the code and test it in any server.  

The concepts covered in this example include

This code here demonstrates the 4 things, populating an array.  Assigning the values of the array to a data source and binding the array.  Lastly displaying the results on a web page.  You can copy and paste the code to test it out.

This example illustrates how to make a link change it’s text when you click on it.  This example converts the anchor tag (<a></a>) to an HTMLControl by placing the runat=”sever” value within the anchor tag.  Using the tag’s ID and some simple C# code between our script tags, we can change