|
|
Newest Topics |
|
| |
As web developers we are faced with many obstacles unique to the medium in which we work. The internet provides an unprecedented audience for our work, but also bears the burden in that its stateless structure often makes it challenge to develop applications that provide the swift and familiar functionality of desktop software. Todays trends are continually headed toward an ever growing interconnected network of people, computers, and information, and the demand for seemless integration is growing amongst end users.
Background
A huge step toward breaching the gap between the thick desktop client flexibility with that of the thin web client has been through the development of client-side callbacks, which is a way to harness the clients browser to communicate with the web server, effectively targetting information that changes - but leaving the remaining markup untouched. This technology grew to be known as AJAX, which stands for Asynchronous Javascript and XML. The AJAX movement has become incredibly large as people have discovered how to harness the ideas and benefits of AJAX techniques and applied them to create richer and more interactive applications on the web. One striking aspect of true AJAX in action is that it involves a real knowledge...
Read More
|
The DispatherTimer.Tick event is the best way in .Net to create an animation loop for either a game or graphical application, but use of it in VB.Net is tricky. I've seen several articles posted around the internet how to use the DispatherTimer's Tick event with C# and I will show you that here in case you're a C# programmer that happened upon this article:
C# using System.Windows.Threading;
private DispatcherTimer _dpTimer;
_dpTimer = new DispatcherTimer(); _dpTimer.Interval = TimeSpan.FromMilliseconds(20); _dpTimer.Tick += new EventHandler(CalledFunction); _dpTimer.Start();
void CalledFunction(object sender, EventArgs e) { }
What you tend to find with this code when translating it to VB.Net is that the .Tick += new EventHandler will not work. It will give you some crazy syntax error about handlers.
To make this work, you have to make sure you're including the System.Windows.Threading class into your form.
Here's how I addressed using the .Tick function in VB.Net
VB Imports System.Windows.Threading
Private dpTimer As DispatcherTimer
Public Sub New() dpTimer = New DispatcherTimer dpTimer.Interval = Timespan.FromMilliseconds(20) AddHandler dpTimer.Tick, AddressOf CalledSub dpTimer.Start() End Sub
Private Sub CalledSub 'Perform your per-tick work here End Sub
The 20 milliseconds will make your loop run about 30 times per second (assuming there's not any intense workload for the computer running it). VB.Net also will not automatically recognize the .Tick when you add it to the dpTimer...
Read More
|
The CrystalReportViewer built into Visual Studio provides a simple and powerful way to display Crystal Reports. The Report Engine actively works behind the scenes to produce interactive reports appropriate for a web-based environment. One negative aspect of the CrystalReportViewer for ASP.NET is, however, that it requires a large amount of postbacks to do its work. This of course produces undesirable screen flicker. Anyone familiar with the recent trend in web development toward seamless transitions via AJAX will know that this technology has become tightly integrated into Visual Studio into its latest 2008 release, and is available as an extension to 2005. The logical idea is, of course, to throw AJAX into the mix to solve this problem. That problem is, it doesn't quite work as expected...
The CrystalReportViewer itself produces output that is not directly compatible with the ASP.NET AJAX UpdatePanel control. What you will run into quickly is that the Export and Print functionality provided by the CrystalReportViewer will not function - no print or export dialog boxes will apear to the user. The solution is more of a compromise - you cannot at the time being (until BusinessObjects produces an updated version) use the UpdatePanel to entirely suppress...
Read More
|
The SQL ORDER BY clause is very useful to sort your results quickly and easily. An underlying problem with ORDER BY is that, in its simplest implementation, we are quite limited to how it actually functions. We leave the SQL Engine of our database of choice to decide what the order is. Typically we could use the ORDER BY clause to either modify the sort order -
SELECT * FROM EMPLOYEES ORDER BY EMP_ID [ASC|DESC]
or even numerically order the columns to sort based on the SELECT clause -
SELECT EMP_ID, NAME FROM EMPLOYEES ORDER BY 1,2
These approaches give us some control over how this clause functions, however it isn't very friendly or functional when we have very specific needs. What if we need to specify a custom order that the basic functions of ORDER BY are incapable of?
Using our Employee example again, what if we need to order by a specific seniority level - say we want the supervisors to appear first, then associates, then executives. We may get lucky with a standard ORDER BY, but odds are it won't work out as we intended. For simplicity's sake, the seniority level is a field within the EMPLOYEE table.
To solve this...
Read More
|
Formatting numbers in programming because a very important task especially when dealing with percentages, currency, and dates. For more about formatting dates, visit this article: http://www.stellarpc.com/articles/board.aspx?id=7
First, I'm going to start with general number formatting and the FormatNumber function. The return value of this function is the number formatted in the manner specified in the parameters being passed. What are these parameters? Here is what it looks like:
FormatNumber(value [, trailing digits] [, leading digit] [, parentheses] [, group digits]) All of the parameters for this function are optional, so you can simply call a FormatNumber(9876.54321) and you will get back 9,876.54 as the return. This is good for quick & simple 2 decimal point return with commas because 2 trailing digits is the default.
To specify the decimals, we'll pass that number in the trailing digits parameter: FormatNumber(9876.54321, 6) and get a return of 9,876.543210 because we requested 6 trailing digits.
In the leading digits column, we're passing a boolean value of True or False to say if you want leading digits to show up... so when your number is less than 1, you're specifying if you want it to appear as 0.99 or just...
Read More
|
Collections are used all over in .Net programming, and there are quite a few native collections that you can utilize... however, many programmers find the need to create their own collection object because collecting your instances of objects into arrays works, but doesn't give you any additional properties. When I create new objects, I create both a Collection and a regular instance of the objec in the same .vb file (this same thing pertains to objects in C# as well, though the syntax will be different).
I start off with this:
Public Class NewObjectCollection Inherits CollectionBase
End Class
Public Class NewObject
End Class
Go ahead and set your variables and properties for the regular object like you normally would, but hold off on that for the collection until you fully understand what the collection does.
Once you've got all the properties set up, then inside your collection object, you'll want a method to fill the collection somehow. For most of us, this is a SELECT from a database table to get all the records and we're going to be storing each as an object in the collection object. Before we create the fill method, we want to create our...
Read More
|
XAML (pronounced zamole), which stands for Extensible Application Markup Language is what we use when we're drawing the output for Silverlight applications. You can get XAML authoring tools such as Microsoft Expression Blend, but most of us developers who are learning to program in Silverlight probably don't have that tool or any others. For now, in starting your learning experience, you're going to have to write the XAML. Visual Studio 2008 allows us to drag & drop some of the controls from the Toolbox to the XAML window, saving some time, but because there isn't a properties window yet, you have to know what the commands are to make edits. When you start, you should see something like this:
You will want to drag your new controls or type them into the Grid section of the basic layout. Above, I've converted the background color to a basic blue.
First, I'm going to drag a TextBlock in:
<TextBlock></TextBlock>
This is much like a label to ASP.Net pages (.aspx). Well, in order to actually see...
Read More
|
One tricky bug in Visual Studio 2003 I ran across recently involved an exception being thrown when programmatically settting a page title by reading in a key from the web.config file. We first need to define our title as being run on the server side:
<title runat="server" id="PageTitle">
We can then set this value dynamically in the code-behind:
PageTitle.InnerText = ConfigurationSettings.AppSettings("title")
The exception in particular stated that a control being referenced does not exist, which is very strange - nothing is incorrect with the particular bit of code. I scratched my head at this for awhile. The html tag we defined was clearly set up to run at the server level, and our Page_Load() code is valid. The problem is that Visual Stuio.NET 2003 actually gets to helpful here and actually removes the runat="server" portion of our <title> tag. This is an intermittent issue, but it is something to keep in the back of your mind when working with the page through a configuration file!
Read More
|
ASP.NET offers programmers a wealth of options and features to provide users with deep and interactive data-driven applications. As its name implies, this functionality is made possible due to the server it resides on. As ASP.NET developers, we are (for the most part) restricted to working exclusively on the server end - the client is fairly well protected from us accessing their machine. This works well most of the time - but what about when we want to harness the power of the users browser or computer? This is an arena that JavaScript has reigned supreme over for a number of years. While the two technologies are seperate in their own right, we can use the .NET library to mix these two technologies together, allowing us to programmtically utilize JavaScript functionality in our ASP.NET code-behinds.
A project I recently worked on decided very late in the project lifecycle that the free Google Analytics service was to be included on every page in our application. At this point we were looking at a fairly intensive manual process to update all of our pages - and possibly even worse was that there was not a real intuitive way to safe-guard this in...
Read More
|
One of the most common tasks when building ASP.NET web applications is displaying the data. When a web application contains high volume of data, paging functionality can help the user view web page easily and clearly. Unlike paging functionality built in ASP.Net DataGrid control, ASP.Net repeater control provides more user defined flexibility. The following code will show you how to create paging control in ASP.Net repeater control.
On the html page:
<html> <head> </head> <body> <form> <table> <tr> <td align="center"><asp:hyperlink id="lnkPrev" Runat="server" text=" << Previous" Visible="False"></asp:hyperlink><asp:hyperlink id="lnkNext" Runat="server" Visible="False" Text=" Next >>"></asp:hyperlink> </td> </tr> <asp:repeater id=”rptTemp” ruant=”server”> <ItemTemplate> <tr> <td > <asp:Label ID="lblID" Runat="server" text=’%#DataBinder.Eval(Container.DataItem, “ID")%>’</asp:Label> </td> <td > <asp:Label ID="lblName" Runat="server" text=’%#DataBinder.Eval(Container.DataItem, “Name")%>’</asp:Label> </td> <td > <asp:Label ID="lblDesc" Runat="server" text=’%#DataBinder.Eval(Container.DataItem, “Description")%>’</asp:Label> </td> </tr> </ItemTemplate> </asp:repeater> </table> </form> </body> </html>
In the code behind:
Dim objPds As PagedDataSource = New PagedDataSource Dim dv As DataView = New DataView(bindTable)’bindtalbe is a collection of data objPds.DataSource = dv objPds.AllowPaging = True objPds.PageSize =10(‘how many data you wish to display) If objPds.PageCount > 1 Then lnkPrev.Visible = True lnkNext.Visible = True Dim curpage As Integer If Not IsNothing(Request.QueryString("Page")) Then curpage = Convert.ToInt32(Request.QueryString("Page")) Else curpage = 1 End If objPds.CurrentPageIndex = curpage - 1 ... Read More
|
|
|
|
|
|
|
|
About StellarPC.com |
|
| |
StellarPC.com is a new, free, tech community where we encourage intelligent
discussion of programming techniques, website development, troubleshooting, and
many other areas of I.T. functions.
More about us...
Donate to help us out
|
|
|
|
|
|
|