asp.net

Emulate ASP.NET validation groups with jQuery validation validation

ValidationGroups

In WebForms, we have the concept of a ValidationGroup to mitigate the issues that come with wrapping the entire page in a single form element. Whether right or wrong in principle, this scheme does a pretty good job of keeping the ASP.NET Validation controls from getting their wires crossed on complex forms.

However, using ASP.NET’s ValidationGroups requires that you use the WebForms validation controls, which generates quite a bit of cruft in your markup and injects two additional script references on your page.

If you’re like me, trying to trend away from client-heavy WebForms pages these side-effects are prohibitive.

Emulating Validation Groups

Though More >

Working with GDI+ in ASP.NET

The best way to start is with an example.

Creating graphics on the fly is not rocket science when using ASP.NET. First thing you need to do is add a using directive in the code-behind file:

using System.Drawing; using System.Drawing.Imaging;

Next a new instance of the Bitmap object must be created in the WebForm1 class:

Bitmap Bmp;

We’ll start by creating a new gif graphic with no background defined or anything else. You can place this in the Page_Load() event:

Bmp = new Bitmap(300, 200);

Bmp.Save(Response.OutputStream, ImageFormat.Gif);

We can see that the graphic is a rectangle with 300 width and 200 height. The graphic is saved to the OutputStream and therefore it is displayed in the web page More >

Sending emails with ASP .NET

I can’t imagine a complete website that hasn’t got a function to email someone, either the user when he registers or the administrator when someone contacts him through the website. No doubt, ASP.NET must have a class that can be used to send emails. Actually, there are two: SmtpMail and MailMessage.

In this article, you’ll see how sending email with ASP.NET is possible and then we’ll go deeper to see how you can use HTML emails or include attachments.

But first you’ll need to check if the Microsoft SMTP Service is turned on. To do this either open the Internet Services Manager directly or More >

Skype May Be Shut Down

eBay, the owner of Skype since the 2005 purchase, has recently announced that due to a licensing disagreement with the founders of Skype, it may have no other option than to shut down the application.

Skype was founded by two Danish entrepreneurs, Niklas Zennstrom and Janus Friis, and purchased by eBay in 2005 for $2.6 billion. However, the purchase executed at that time did not include a core component of the VoIP service that powers the Skype application, and this technology had to be licensed by eBay from the founders over the past few years.

The two founders of Skype have recently More >

ASP.NET 2.0 Script CallBack (Ajax like)

Download this ASP.NET 2.0.50215 (BETA) C# project (can easily be converted to VB.NET)

Download this ASP.NET 2.0.50727 C# project (can easily be converted to VB.NET)

You probably already know what Ajax does, or maybe not, but what’s certain is that you heard about Ajax because much fuss is created around it on the web.

In this tutorial you’re going to learn a very interesting technique of combining client-side JavaScript with server-side ASP.NET 2.0. More exactly, we’re going to implement a simple rating system (a listbox and a button) which can be used to rate content on websites. But there’s something special about it: when the More >

Create an RSS feed using ASP.NET 2.0

n this tutorial we’re going to create a similar RSS feed, using ASP.NET 2.0.

In the ASP.NET 2.0 project, create a new file which will be the RSS feed. We used “TodaysHeadlines.aspx”.

Now open the markup of the file and replace everything inside it with the following two lines:

Don’t forget to change the CodeFile and Inherits attributes of the Page tag in case you gave your RSS file a different name than TodaysHeadlines.aspx.

If you’re wondering what the second page does: it tells the ASP.NET server to keep the page in cache for 120 seconds (2 minutes) so that the SQL server doesn’t have to be More >

Connect to Access Database in Visual Studio .NET

ou can use DataSets or DataReaders to read the information from the database. A DataReader is about twice as fast as a DataSet (according to Sams Publication). This tutorial uses DataReaders to read the data from a Microsoft Access Database in Visual Studio .Net 2003. ASP.NET web application is used in this tutorial so at the end you will have a web page that derives its data from an Access database.

Following are screen-shots along with some description but I recommend you view the VIDEO TUTORIAL.

STEP-1:

Open up Visual Studio .NET 2003 and click on New Project on the Start page:

STEP-2:

In the New More >

Accessing the controls and methods of a MasterPage

It won’t take you long to use MasterPages and feel the need to call a method or a property of that MasterPage class from inside a web form. The typical instinct is to use Master.MethodName() inside the ASP.NET web form file. Unfortunately that will not work… fortunately there is a an easy fix. First we’ll quickly review how to create the MasterPage and the web form, then we’ll move on to accessing the MasterPage’s method.

How to create a MasterPage to use with a Web Form

Start by creating an ASP.NET 2.0 Web Site project in Visual Studio 2005 and besides the already existing Default.aspx More >

Initiate Download Using ASP.NET and VB.NET

  1. Private Sub FetchFile(ByVal strFromPath As System.String, ByVal strSendWithName As System.String)
  2. Dim strServerAbsPath As String
  3. Dim infFile As System.IO.FileInfo
  4. ‘ Change the relative path to the absolute path
  5. strServerAbsPath = Me.Server.MapPath(strFromPath)
  6. ‘ Will use to check if the file exists
  7. infFile = New System.IO.FileInfo(strServerAbsPath)
  8. ‘ If it does…
  9. If infFile.Exists Then
  10. With Me.Response
  11. ‘ Send headers
  12. .ContentType = “application/octet-stream”
  13. .AddHeader(“Content-Disposition”, “attachment; filename=” & strSendWithName)
  14. .AddHeader(“Content-Length”, infFile.Length.ToString)
  15. ‘ Send the file
  16. .WriteFile(infFile.FullName)
  17. ‘ Send and end the response
  18. .Flush()
  19. .End()
  20. End With
  21. ‘ File does not exist
  22. Else
  23. ThrowError(“IO Error”, “File Not Found”)
  24. End If
  25. End Sub
Get Adobe Flash playerPlugin by wpburn.com wordpress themes