This week, I needed to bind a gridview to and SQLDataSource. The only problem is that I need to include extra rows. How to do this? First I removed the binding code to bind the grid directly from HTML (in gridview remove the DataSourceID attribute).
Then I wanted to get the data from the SQL Data source and convert to a data table to insert and update the table as needed. Next is the code to get the data… Continue reading
When you create a table in SQL Server, you would also have an Identity Primary Key. This type of key would increase as new rows are added. But sometimes you would just need to delete all the rows and start all over again.
To restart the identity column, you could delete the column and re-add it again. This would normally work, but if you have relations with the primary key, you wouldn’t be allowed to delete it.
The next code that will make this possible, and restart the Primary Key from 0, thus the new row will be set as 1: Continue reading
When creating a CMS sometimes you need to allow certain tags pass through the ASP.Net Validation. To allow tags be posted, in v2.0, you had to include the following tag in the page directive:
But in .Net 4.0, this is not enough. You also need to include the next tag (httpRuntime) in the web.config file under <system.web>:
<compilation debug="true" targetFramework="4.0" />
<httpRuntime requestValidationMode="2.0" />
There is also other information on Error validation in .Net 4.0 here
To get the Background Colour in Windows Phone 7 as selected by the user, you need to use the following 2 lines of code: Continue reading
Whilst testing out Windows Phone 7 Development using Silverlight, I needed to get the Default Theme Foreground Colour that is set by the user. To get the Foreground colour you need 2 lines of code: Continue reading
Today I started researching and making some Windows Phone 7 apps. The development tools are all free. You just need to download the free tools from here and everything will install automatically.
The Windows Phone tools are added to the Visual Studio 2010 IDE so you won’t find any problems starting using it. WP7 apps are developed using Silverlight for Windows Phone or XNA 4.0. Continue reading
Sometimes in C#, to call overloaded methods within the same method names, we still use the old method. In C# there is a neater way to pass arguments to overloaded methods which can be seen below:
First you need to create a HiddenField on your webForm and name it TokenField (any name would actually do)
<asp:HiddenField ID=”TokenField” runat=”server” />
Instead of using the “<a href=” tag to go to another page, you can use the “<div onclick=” to be transferred to another page. This is extremely useful if you have a lot of text and pictures that need to be clicked anywhere wanted. Next is the html code to achieve this:
<div id="div_id" onclick="window.location = 'Your reference here'>
Your text here
Hope this Quickie was of help 😉
Today I was using Intelligencia URLRewriter to use Search Engine Friendly URL’s to improve my site’s SEO.
All was working fine until I inserted a button in the page. When I clicked the button, the URL address showed the original URL and stopped working… the button didn’t even do the postback.
The Solution… Continue reading