Thursday, November 20, 2008

Download Free E Book on CSS designs



If you are looking for some books to learn CSS, here’s an excellent book for FREE download.

You can download The Art and Science of CSS directly from here or follow sitepointdotcom on Twitter.



The Art and Science of CSS is a good Cascading Style Sheets book with lot of practical examples on different style sheet techniques such as designing navigation tabs, styling web pages, creating rounded corners etc.

DOWNLOAD THE FREE COPY FROM HERE

.

Thursday, October 23, 2008

Asp.Net CAPTCHA and Asp.Net AJAX CAPTCHA


I am using a great Asp.Net CAPTCHA by BrainJar in a number of web sites with and without Asp.Net AJAX. It’s a simple and really easy to use Asp.Net CAPTCHA. The actual source code is in C#, but you can use it with both C# and VB.Net by simply wrapping the functionality in a class library.

In Asp.Net forums and in many other user communities I have seen lot of people asking for VB.Net CAPTCHA. So I thought to write a blog post and create some sample implementations. The zip file contains C# CAPTCHA and VB.Net CAPTCHA. I have included the samples for Asp.Net AJAX CAPTCHA also.

You can download the samples and implementation from here

Implementing Asp.Net AJAX CAPTCHA is really simple. Just wrap the main Asp.Net CAPTCHA with Asp.Net AJAX update panel and put a random query string at the end of CAPTCHA image src. The random query string will avoid showing the old CAPTCHA from browser cache.

STEPS TO ADD ASP.NET CAPTCHA IN YOUR WEBSITE
  1. Refer the assembly CaptchaDLL.dll in your project
  2. Copy JpegImage_CS.aspx or JpegImage_VB.aspx (according to the language of choice) to your website.
  3. Open the above file and make changes in Colors and Font if needed. (read the inline comments to know more)
  4. Now user the sample codes from Default.aspx or Ajax.aspx pages. The code is straight forward. You make a session and generate an image with the string in the Session. Now when you submit you have to check the session value and textbox value to see whether the entered CAPTCHA is correct.
DOWNLOAD THE SOURCE AND SAMPLES FROM HERE

If you have any questions please put as a comment.

Tags
Asp.Net CAPTCHA, CAPTCHA, VB.Net CAPTCHA, C# CAPTCHA, ASP CAPTCHA, C sharp captcha, vb captcha, simple captcha, AJAX CAPTCHA, asp.net ajax captcha, captcha without refresh, captcha using ajax, numeric captcha

Wednesday, October 22, 2008

Numeric Datalist/Repeater paging - User control version

I have wrapped the functionality of numeric datalist pagination (read the full details here) into a user control, so that you don’t need to copy and paste the code in all the pages.
The usercontrol and sample implementation with some good pagination style can be downloaded from here.

DOWNLOAD THE SOURCE AND SAMPLES FROM HERE

Visit this blog if you want to know the details about implementing numeric paging with datalist or repeater.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you are looking for Sql Express DTS/Data transfer wizard click here
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

TAGS
datalist pagination,paginating datalist,pagination datalist,asp.net datalist pagination,datalist and pagination,c# datalist pagination,pages datalist,paging datalist,datalist paging,repeater pagination,paginating repeater,pagination repeater,asp.net repeater pagination,repeater and pagination,c# repeater pagination,pages repeater,paging repeater,repeater paging

Friday, October 10, 2008

Simple Numeric Pagination for DataList and Repeater

There are a big number of tutorials available on how to implement pagination in asp.net DataList and Repeater. But all of them are explaining only about the Next/Prev mode of pagination only. Recently I have implemented a quick and dirty numeric pagination on DataList for one of my project.

The idea is simply use a PagedDataSource to get the current page of data and bind it to DataList or Repeater. Now create dynamic Linkbuttons using the PageSize and the Total rows count. See the code below.

ASPX Code

<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.pagination a{padding:5px;}
.pagination span{padding:5px;}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DataList ID="dlPaginationSample" runat="server">
<ItemTemplate>
<%# Eval("Column1")%> | <%# Eval("Column2")%>
<br />
</ItemTemplate>
</asp:DataList>
</div>

<br />
<asp:Panel runat="server" id="pnlPager" CssClass="pagination">

</asp:Panel>
</form>
</body>

C# Code
//you can pass either DatList or Repeater to this function
private void bindDataWithPaging(Control bindControl, DataSet data)
{
if (data.Tables.Count > 0) // if the datset contains data
{
DataView dv = data.Tables[0].DefaultView;

PagedDataSource dsP = new PagedDataSource();
dsP.AllowPaging = true;
dsP.DataSource = dv;
dsP.CurrentPageIndex = CurrentPageIndex;
dsP.PageSize = PageSize;

//Binding data to the controls
if (bindControl is DataList)
{
((DataList)bindControl).DataSource= dsP;
((DataList)bindControl).DataBind();
}
else if (bindControl is Repeater)
{
((Repeater)bindControl).DataSource = dsP;
((Repeater)bindControl).DataBind();
}

//saving the total page count in Viewstate for later use
PageCount = dsP.PageCount;

//create the linkbuttons for pagination
BuildPagination();
}
}

The above function is straight forward and self explanatory. What it will do is simply create a PagedDataSource from the full dataset and bind it to the custom pagination repeater or datalist.


//create the linkbuttons for pagination
protected void BuildPagination()
{
pnlPager.Controls.Clear(); //

if (PageCount <= 1) return; // at least two pages should be there to show the pagination

//finding the first linkbutton to be shown in the current display
int start = CurrentPageIndex - (CurrentPageIndex % ButtonsCount);

//finding the last linkbutton to be shown in the current display
int end = CurrentPageIndex + (ButtonsCount - (CurrentPageIndex % ButtonsCount));

//if the start button is more than the number of buttons. If the start button is 11 we have to show the <<First link
if (start > ButtonsCount - 1)
{
pnlPager.Controls.Add(createButton(FirstPageText, 0));
pnlPager.Controls.Add(createButton("..", start - 1));
}

int i = 0, j = 0;

for (i = start; i < end; i++)
{
LinkButton lnk;
if (i < PageCount)
{
if (i == CurrentPageIndex) //if its the current page
{
Label lbl = new Label();
lbl.Text = (i + 1).ToString();
pnlPager.Controls.Add(lbl);
}
else
{
pnlPager.Controls.Add(createButton((i + 1).ToString(), i));
}
}
j++;
}

//If the total number of pages are greaer than the end page we have to show Last>> link
if (PageCount > end)
{
pnlPager.Controls.Add(createButton("..", i));
pnlPager.Controls.Add(createButton(">>", PageCount - 1));
}
}


This is the whole logic for a simple implementation. I am using this custom pagination in a number of projects and they are working great.

DOWNLOAD THE SOURCE AND SAMPLES FROM HERE for numeric datalist pagination

Tags
Implement custom numeric pagination with datalist and repeater, Datalist pagination, repeater pagination, paginating datalist, paginating repeater, numeric custom pagination, custom datalist pagination, custom repeater pagination, repeater numeric pagination, datalist numeric pagination, pagination with datalist and repeater, implement pagination datalist, asp.net datalist pagination

Wednesday, October 8, 2008

Move to anchor after ASP.Net AJAX postback

Here is the code to move to anchor after postback

<script language="javascript" type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(OnEndRequest);
function OnEndRequest(sender,args)
{
window.location.hash = '#MOVEHERE'; //MOVEHERE is the anchor name
}
</script>

If you want to show top of the page instead of move to anchor use window.scrollTo(0,0); instead of window.location.hash = '#MOVEHERE';

Tuesday, August 19, 2008

Move to anchor after postback

You can add anchor tags in the URL to move the scroll bar to a specific section of the web page.
Example : http://www.w3.org/TR/html401/struct/links.html#h-12.2.1

But how we can do the same after a postback. I am not talking about MaintainScrollPositionOnPostback. It will just move the scroll bar position to the previous state after the postback.

Our aim is to move the scroll bar to a custom position using anchor tags.

1. Set MaintainScrollPositionOnPostback="false" in the @Page directive.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default1.aspx.cs" Inherits="view_Default1" Title="Untitled Page" MaintainScrollPositionOnPostback="false" %>

2. Create a named anchor in the HTML.
<a name="MOVEHERE"></a>

3. Write the follwoing code in the page load.
if (IsPostBack)
{
ClientScript.RegisterStartupScript(this.GetType(), "hash", "location.hash = '#MOVEHERE';", true);
}
Please note I wrote the code inside IsPostback.

Thats all. Now test the page and you can see the page automatically move to the #MOVEHERE anchor when the page loads after a postback.

The javascript code location.hash = '#MOVEHERE'; did the trick.

I have tested it in IE 6, FF 2.x, Apple Safari for Windows and Opera.

Monday, June 30, 2008

Free Ebooks from Microsoft Press


There is a big offer from Microsoft Learning centre. Download the entire contents
of the print books, Introducing Microsoft Linq, Introducing Microsoft ASP.NET AJAX,
Introducing Microsoft Silverlight 1.0.




The download link is here



Foundations of Programming Free Ebook


Karl Seguin of www.codebetter.com wrote a great ebook. You can download it for free from here.

For more details about the book check here

Saturday, June 28, 2008

Its decided!! Internet is gonna change in the bigway.


The vote to lift restrictions on top level domain names wins the approval. The net's regulator, Icann, voted unanimously to relax the strict rules on so-called "top-level" domain names, such as .com or .uk.

The decision means a domain name can be anything.anything . So the big debated .xxx is going to happen. So far Icann has rejected calls for a .xxx domain on the grounds that it might be forced to act as a censor. But now it could get the green light.

A second proposal, to introduce domain names written in Asian, Arabic or other scripts, was also approved.

Read the full news here

Monday, June 23, 2008

Biggest change on the internet world is proposed


The net's regulators will vote on Thursday to decide if the strict rules on so-called top level domain names, such as .com or .uk, can be relaxed.

If approved, the net could see its biggest transformation in decades. The new plan will allow companies to turn their brands into domain names while individuals could also carve out their own corner of the net.

See full story here and express your views here

Sunday, June 22, 2008

Import contacts from yahoo, gmail, hotmail etc using .Net


Contacts Reader .NET 1.0 from Idea Bubbling is an open source project to import contacts from different e-mail providers. Currently it supports Yahoo, Hotmail, Gmail, AOL Mail, Rediffmail.

Demo Page | Downloads Page

View Now option for your PDFs and DOCs


If you want to give a "View now" option for your PDFs and DOCs simliar to the "View as HTML" in Gmail you can use the free service by http://view.samurajdata.se/

This is an online viewer, with which you can view PDF and PostScript files as browsable images and Word documents as web pages.

Its really fast and easy.

Just give your pdf link as the parameter and it will automatically convert it.
Example http://view.samurajdata.se/ps.php?url=http://www.uddi.org/pubs/Iru_UDDI_Technical_White_Paper.pdf

The big list of Rich Editor Controls (WYSIWYG) that you can use with ASP.NET


Joe Stagner of Microsoft has made a list of WYSIWYG editors for Asp.Net..

You can see it here

Personally I like TinyMCE

Saturday, June 21, 2008

Build a game and win $75,000 in prizes!!


Take part in the game build contest Dream-Build-Play 2008 launched by XNA team and win $75,000 in prizes and receive an Xbox Live Arcade Contract.

  • Create and deploy Xbox360 games using XNA Game Studio 2.0
  • $75,000 in prizes and the chance to receive an Xbox Live Arcade Contract.
  • Everyone who registers will receive a FREE 12-Month Trial Creator Club Membership

For more information log on to www.dreambuildplay.com

Sunday, June 8, 2008

Import/Export data with SQL Server 2005 Express - DTS Wizard


After using the simple sql server 2005 data transfer utility for some days I thought to add more functionality such as import export data from excel, CSV, flat file etc.

Before start coding I just did a Google search and found this big and interesting discussion in MSDN forums. In the first page developers were really annoyed with the fact MS is not giving a data transfer utility with Sql Server Management Studio Express.

I read the conversation one by one and in the 5th page I found this posting by Bill Elicson. MS actually has a really great DTS tool for sql server management studio express.

Thanks Bill.. you saved alot of time.

STEPS TO ADD DTS WIZARD WITH SQL SERVER MANAGEMNT STUDIO EXPRESS

1. Try "C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTSWizard.exe"
If it worked, you already have the DTS Wizard. Start using it right away.

If it will not work, continue to step 2

2. Download the Microsoft SQL Server 2005 Express Edition Toolkit (223.9 MB) from

http://go.microsoft.com/fwlink/?LinkId=65111
select all components to install

3. Run "C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTSWizard.exe"

Thats it.. Now you can transfer data using the the great DTS wizard.

Follow the steps If you want to integrate it with the Sql server management studio express UI .
1. Open sql server management studio express.
2. Select Tools -> External Tools
3. Add a Title and Browse C:\Program Files\Microsoft SQL Server\90 \DTS\Binn\DTSWizard.exe for the Command field.
3. Click OK

TAGS
Importing Exporting Data sql server express,sql server express data transfer, dts sql server express, sqlserver express DTS, move data sqlexpress 2005, SQLEXPRESS 2005 to SQL 2000 Data Transfer, Data import/export with SQL Server Express using DTS Wizard, Data Transfer between SQL Server and SQL Server Express

Thursday, April 17, 2008

Sql Server 2005 Express Data Transfer

Since there is no mechanism to transfer data from one DB to another in Free SQL Server 2005 Management Studio Express I thought to write a simple utility to do this.

It’s so simple that you can use with only MS Sql Server and transfer data from one table at a time.

The utility is using ADO.Net SqlBulkCopy class to achieve the functionality.

Steps to transfer the data from one DB to another

  1. Enter DB connection information of both Source DB and Destination DB.
  2. Click Connect
    If there is no error in the connection details it will establish connections to both server and list all the tables in both Db in bottom combo boxes.
  3. Choose the source table from left side combo box and designation table from right side combo box.
  4. Click Transfer.
Notes
  1. Work only with Sql server.
  2. Tested only in Sql server 2005.
  3. Both source table and destination table should be similar.

Sql2005_DataTransfer.zip




Search

Google