Friday, April 13, 2012

Paging in Classic ASP

ConnectionString ="DSN=DataSourceName"
SQLS = "SELECT * FROM TableName"

Set PRS = Server.CreateObject("ADODB.Recordset")
PRS.CursorLocation = 3 ' adUseClient
PRS.PageSize = 10
PRS.Open SQLS, ConnectionString

CurrentPage = 1
PRS.AbsolutePage = CurrentPage
Do While Not ( PRS.Eof Or PRS.AbsolutePage <> CurrentPage )
    PRS.MoveNext
Loop
PRS.Close
set PRS = nothing

References:
http://support.microsoft.com/kb/202125
http://www.codeproject.com/Articles/619/ADO-Recordset-Paging-in-ASP

The Big Glossary of Open Source JavaScript and Web Frameworks with Cool Names

http://www.hanselman.com/blog/TheBigGlossaryOfOpenSourceJavaScriptAndWebFrameworksWithCoolNames.aspx

Tuesday, April 10, 2012

How to include TinyMCE editor in ASP.NET MVC 3 razor view?

- Download the latest version from: http://www.tinymce.com/download/download.php
- Extract JavaScript folder into a folder under Scripts, and include files into MVC project
- Copy and Paste following code into the view you want to use

<script type="text/javascript" src='@Url.Content("~/Scripts/tiny_mce/tiny_mce.js")'></script>
<script type="text/javascript">
    tinyMCE.init({
        mode: "textareas"
    });
</script>
<form method="post" action="somepage">
<textarea name="content" style="width: 100%"></textarea>
</form>


- Most important thing: double check the path (JavaScript file tiny_mce.js) is correct
References for HTML editor:
HTML eidtor:
http://ckeditor.com/demo
http://www.tinymce.com/tryit/full.php
http://drupal.fckeditor.net/demo
http://www.webdesignerdepot.com/2008/12/20-excellent-free-rich-text-editors/
http://blogs.planetcloud.co.uk/mygreatdiscovery/post/Using-CKEditor-and-TinyMCE-with-ASPNET-MVC.aspx

Request Validation with ASP.NET 4.5 : A deep dive

http://brijbhushan.net/2012/04/03/request-validation-with-asp-net-4-5-a-deep-dive/

ASP.NET page life cycle