Posts tagged ‘ASP.NET’

New Site For ASP.NET Demos: dhvrm.com

I have launched a new Web site to demo ASP.NET scripts. It is http://www.dhvrm.com.

I decided to create the site after reviewing my last couple of ASP.NET entries on this site and discovering that they have some serious errors. I’ll be updating each with new posts as time allows.

For the moment, there isn’t much to see at dhvrm.com, and my schedulewon’t't allow me to do too much more with it for the next few weeks.

But I will correct my ASP.NET scripts and try to create new demos for older posts that don’t have them in the near future. Stay tuned.

Displaying An Image Stored In A SQL Server Database On An ASP.NET Page Using VB.NET

Recently asked on Yahoo! Answers:

How do I read and write binary image data from SQL server?
I’m making a website where visitors can upload their images, I’ve done the uploading code and it (probably) works fine because I can see the data is recorded on the database.

The problem is when I want to test it (display the image on the website) theoretically I have to read the data from the SQL server and write it to the web. I’ve done several ways and tests but all of them failed to display the image.

Anybody knows how to do this? I’m using visual web developer 2008 and VB.NET as programming language

Note: no “wizards” please, I want it to be implemented using fully coded like I did with the uploading code

There are other examples on the Web on how to do this, but most are either written in C#, or are very specific to a given set of circumstances, so I thought I would explore this subject for Visual Basic .NET, and in the process try to address a few different ways to display an image.

The executive summary: Displaying an image that’s stored in a database requires you to make a “helper page.” And that’s what we’re about to make.

Continue reading ‘Displaying An Image Stored In A SQL Server Database On An ASP.NET Page Using VB.NET’ »

Adding Non-Selectable ListItems To An ASP.NET DropDownList Control

Recently asked on Yahoo! Answers:

Im working in dropdown list box in asp .net
where i wan d dropdown list box to have headin for each 10 item, and the heading should not get selected during run time. Plz help

This is easy to do if you dynamically bind each ListItem to your DropDownList; basically, you introduce a while loop to the mix to occasionally insert the requested number of breaks. Then, we add a CustomValidator control to ensure the user can’t select one of the heading items.

I won’t have a working example but I will provide a text file at the end which contains all the code.

Continue reading ‘Adding Non-Selectable ListItems To An ASP.NET DropDownList Control’ »

A Charity Donation Recognition System Using PHP, MySQL, JavaScript And DOM

Recently asked on Yahoo! Answers:

Divide photo in 5,000 pieces with rollover text?
we are raising money and selling support tickets. To show our progress we are going to start with a black and white image split in 5,000 pieces then as each piece is sold we want to turn it into color.

When you roll over each piece the person who purchased that support ticket will have their name show up as well as a personal message.

any opinions on how this should be built? The admin section will all be managed manually, so we’ll just need a backend for the admin person to go in and make the changes manually.

This seemed an interesting challenge to me; not difficult, but with multiple steps that no beginner could hope to properly tackle on his own without some help.

This project calls on almost all the basic skills a competent Web developer should possess: Image editing; database design and simple queries; DOM manipulation; security and back-end systems, and therefore, it gives me my first real opportunity in quite some time to address a project in full scope.

As always, I’ll have a link to a working demo and code you can download at the end of this entry.

Continue reading ‘A Charity Donation Recognition System Using PHP, MySQL, JavaScript And DOM’ »

Getting Plain Text From An ASP.NET 2.0 Page For Use As An AJAX Data Source

In a follow-up comment to my answer on his AJAX question on Yahoo! Answers, mzanime2000 posed a problem faced by many ASP.NET programming beginners: how to get ASP.NET to return plain text only for use in AJAX.

Wow thanks! Pretty nice well-detailed response. Now I just hope I can get it to work with ASP.NET, I see that you used PHP in your example. One thing I still dont get though, is how Ajax invokes the SQL data when it looks like you used PHP to do the msql_connect part. And PHP is pre-processed too

ASP.NET is based around two output models: HTML and XML. The whole approach assumes you’re either going to spit out a Web page or some XML at the end of the process. Thus, all the controls, all the tutorials … everything is aimed at outputting HTML or XML. But for an AJAX data source such as the type I discussed in my previous blog entry, you need plain text.

The fix is to remove all HTML formatting from the ASPX page, and place our code directly into the ASPX page itself. That will let us call upon Response.ContentType, which will send our database results as text — which is just what our Google Maps API, and all other AJAX applications, want to see.

Continue reading ‘Getting Plain Text From An ASP.NET 2.0 Page For Use As An AJAX Data Source’ »