Contents tagged with ASP.NET
Once and a while, I come across a problem that requires some "solving". It's a different scenario that the typical "I've done this before, lets do it again", where you may make something better, or more efficient, or refactor it in some way.
A good friend of mine recently revealed to me that he's released a beta to the public of a neat piece of software. Jamcast allows the user to stream their digital audio across their network to devices with built in support like Playstation 3, XBox 360. I can't do the description justice, so swing over to his site and read about it. Sounds like wicked code. Even better is, it's entirely built with a .NET foundation!
I've done an update to the starterkit today, and figured it might be a good idea to get some screenshots in front of people, as well as a demo site up - so I've done both. :)
The demo site is available at
Feel free to register a username and look around. If you don't want to register a username you may use
note: the website may be going up and down as I make changes and perform updates. Please be patient. :)
Just a quick plug to the community. I've gotten to the Alpha release of my AuctionSite Starterkit and have published a release on Codeplex
It's designed and produced in .net 3.5 utilizing some cool features like LINQ, the new Listview, the .NET membership, full CSS design and some other goodies like some Ajax sections. It's freely available for download, take it - use it - abuse it. Its designed to give users a good start in the LINQ world, with a real world application on a smaller scale. It's database is extensible, and pages have been intentionally kept simple and straight forward, so they can be modified, tailored.
I'll be continuing to update it it through a stable release, then refactoring some of the "goofier" sections.
What a great time to be had a development conferences. Putting that many smart people in one room should be illegal honestly. Two solid days of .NET energy (and one adobe flex talk, ...<blink>) - Culminated with a 4 hour presentation by Scott Guthrie on the new Visual Studios 2008 / .NET 3.0 and 3.5 features.
In all the examples we've seen so far, we've returned simple strings, integers, or a standard type / value. That's all fine and good, until we have something a little more complex to return, or need to return a list or array of something, or a list of type. In the following example I'll demonstrate through code how to accomplish just that.
I'm going to go ahead and fire up my service to check it and test the hello world example, once I'm done with that, we can move on!
<?xml version="1.0" encoding="utf-8" ?> <string xmlns="http://tempuri.org/">Hello World</string>
Ok, I hope everyone checked their service, now...to create the complex type that we'll be returning, we need are going to add a new class file to our project, and call it widget.
I'm going to keep the example simple, so I've just wired up two properties, with their private members, and a default constructor with one overload so that I can new it in one line.
Public Class widget
Private _Name As String
Public Property Name() As String
Set(ByVal value As String)
_Name = value
Private _Price As Decimal
Public Property Price() As Decimal
Set(ByVal value As Decimal)
_Price = value
Public Sub New()
Public Sub New(ByVal Name As String, ByVal Price As Decimal)
_Price = Price
_Name = Name
Ok, so back to our webservice to do something with our widget! I'm going to mock up 5 widgets for this example, normally you'd connect to your datasource or collection object to get real life data.
Public Function GetWidgets() As List(Of widget)
Dim tempWidgets As New List(Of widget)
For I As Integer = 1 To 5
Dim tempWidget As New widget("Name:" & I, CDec(I))
I can verify this is working by running the service again and getting this result:
<?xml version="1.0" encoding="utf-8" ?>
- <ArrayOfWidget xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
Ok, now for the fun part, lets work with this data coming back - lets get into the page we'd like to call the webservice, and wire it up. The first thing we'll need is a container to hold this data. I'm just loading up a div in this case, dont forget to set the ID so you can find it.
In this case, I'm going to have a button fire the event that calls the webservice, so we'll add that too:
<asp:Button ID="button1" runat="server" OnClientClick="doWork" Text="Do Work" />
<asp:ScriptManager ID="scriptmanager1" runat="server">
<asp:ServiceReference Path="~/WebService1.asmx" />
I'm going to post the complete example in here - and let you guys parse through it. Please feel free to post comments or questions:
ret = WebService1.GetWidgets(onComplete, onError, onTimeout);
var retData = new Array(5);
retData = result;
var strDiv = ""
var x = 0;
for (x=0; x<5; x++)
strDiv = strDiv + retData[x].Name + " " + retData[x].Price + "<br />";
document.getElementById("returnData").innerHTML = strDiv;
As always, Happy Coding and good luck!
In the first installment of this series, we discussed the reasons for creating a clean and efficient UI, and some of the methods behind it. If you haven't read the first part I suggest you do so here. In this article we are going to go over some of the basics in getting setup to provide a streamlined user interface in a business sector. Examples of use would be an intranet application, a Contact management solution, or some similar file / information store. We'll discuss the pro's and con's of a few model types and ultimately choose a method and start our design. The goal at the end of this article is to provide an interface "shell" that can be reused across different application types. This shell should be similar to a template, but more extensible.
David Yancey over at his Geebs blog has created a slick little bit of code to allow users to put a "Who's online" type of control on their sites by querying the membership provider. It appears it also allows for anonymous users as well. Check it out
I've tried to be as thorough as possible in this series of articles, this articles assume above beginner knowledge of CSS, ASP.NET controls, and AJAX Control Toolkit items. The series is scheduled for 5 parts and at the end of the series I will provide a link to an example project that incorporates and demonstrates the items we'll talk about throughout the series.
I just wanted to take a moment to thank the Cedar Rapids branch of the INETA user group for the warm welcome. I enjoyed speaking to the group tonight, and I hope some useful information was had by all.
I'm in the process as we speak of converting the video I took to a web format, and I'll make it available as soon as I can get it converted to something web friendly.
I look forward to further meetings.
To those that had extended questions - I'll get emails out to you, as soon as I can work up some good examples.
To clarify a few points:
At one point during the presentation I mentioned that PHP was not a high performance platform. I should stand corrected (with a little help). What I should have said was - any I could write under PHP wouldn't be high performance by any means.
One of the most significant questions of the evening was:
'What do you see are the downsides to using Ajax' (non verbatim).
Anyone that has comments about that topic - feel free to post.
Microsoft MVPEDIT: The video is available here -