Introducing Microsoft Deployment Toolkit
The Windows AIK provides a collection of tools and documentation for performing unattended installs of Windows Vista, but these tools are not integrated with one another. For instance, you must use one tool (Windows SIM) to create your answer file, another tool (ImageX) to capture an image of your sysprepped reference computer, yet another tool (Package Manager) to service your images, another tool (WinPE) to boot your bare-metal destination computers, and so on. By adding Windows DS to the mix, you can centralize the management and deployment of your images, but you still have to work with a collection of disparate tools to perform your deployment.
To simplify desktop deployment, Microsoft first created Microsoft Solution Accelerator for Business Desktop Deployment (BDD), an integrated toolset together with comprehensive guidance for deploying Windows Vista and the 2007 Office System. BDD went through several versions including:
BDD 2.0 and 2.5 – Used for deploying Windows XP that was released in two editions: Standard edition for smaller midmarket customers, and Enterprise edition for larger organizations that had an Microsoft Systems Management Server 2003 infrastructure deployed.
BDD 2007 – Used for deploying Windows XP, Windows Vista, and the 2007 Office System and released in a single edition for both midmarket and enterprise customers.
BDD has now morphed into Microsoft Deployment Toolkit 2008 (MDT 2008) which lets you deploy the following versions of Microsoft Windows:
Windows Vista
Windows XP Professional
Windows Server 2008
Windows Server 2003
In addition, you can use MDT 2008 to deploy the 2007 Microsoft Office system and Microsoft Office 2003 to your desktop computers.
MDT 2008 simplifies the task of deploying Windows Vista (the focus of this present series of articles) by providing the following benefits:
Provides an integrated workspace from which you can perform hardware/software inventories, mitigate application compatibility issues, migrate user profiles, package and deploy applications, create and manage distribution shares and deployment points, and to build, service and deploy your images.
Supports integration with Windows DS for centralized server-based deployments.
Supports integration with your existing systems management infrastructures that use SMS 2003 and Microsoft System Center Configuration Manager 2007 (SCCM 2007).
Allows you to customize various aspects of the deployment process to suit the needs of your organization.
Understanding LTI vs. ZTI
Depending on your infrastructure, MDT 2008 enables you to perform two basic types of deployments:
Light Touch Installation (LTI) – Lets you deploy Vista without having any systems management infrastructure in place in your organization. LTI is an ideal solution for small to medium-sized organizations who need to deploy Vista to dozens or even hundreds of systems at a site or in a department. LTI deployments can be performed manually, partially unattended, or almost fully unattended as desired. In its simplest form, LTI can even be used to deploy Vista in a workgroup scenario from a single computer running Windows XP. For greater scalability, you can integrated MDT with Windows DS to perform centralized, server-based LTI deployments.
Zero Touch Installation (ZTI) – Lets you deploy Vista by leveraging the capabilities of your existing SMS 2003 or SCCM 2007 infrastructure. ZTI deployments are usually completely automated in nature and are also usually integrated with Windows DS.
Note: This present series of articles will focus on LTI deployments of Windows Vista SP1 Enterprise Edition.
Types of Deployment Scenarios
MDT 2008 supports a variety of different deployment scenarios:
New Computer Scenario – Deploy Vista onto a bare-metal system that has no operating system for a user who does not have an existing computer or user profile on your network. Use this scenario when deploying systems for new employees.
Upgrade Computer Scenario – Upgrade a system running Windows XP to Windows Vista and retain the user's existing profile settings. Use this scenario when you have existing systems whose hardware will support running Vista.
Refresh Computer Scenario – Re-image an existing system that is already running Vista in order to resolve problems the user is experiencing with her computer.
Replace Computer Scenario – Deploy Vista onto a bare-metal system for a user who has an existing computer running Windows XP. During the deployment process, the user's existing profile settings and data are migrated from her old XP computer to her new Vista computer.
Note:
This present series of articles will focus mainly on demonstrating the New Computer deployment scenario.
Installing MDT 2008
You can install MDT 2008 on x86 or x64 systems running the following operating systems:
Windows Server 2008 Standard or Enterprise edition
Windows Server 2003 SP1 or later Standard or Enterprise edition
Windows Vista Business, Enterprise or Ultimate edition
Windows XP Professional SP2 or later
Depending on the platform you choose to install upon, you may also need to download and install the .NET Framework 2.0, MMC 3.0, and various updates.
It's also a good idea to have a second hard disk drive in the computer you are installing MDT on so that you can use this drive to host MDT's distribution share and (depending on your setup) deployment point. This will be explained in more detail in the next article of this series.
Be sure you begin by downloading the latest version of MDT 2008, which at the time of writing is MDT 2008 Update 1. For the scenario used in this series of articles, we're going to install MDT on a server named SEA-MDT that is running Windows Server 2003 R2 SP2 and which belongs to the contoso.com domain. This means that the only additional software we need to preinstall on the system is the .NET Framework 2.0, which can be obtained from Microsoft Download Center.
Begin by downloading MicrosoftDeploymentToolkit_x86.msi or MicrosoftDeploymentToolkit_x64.msi as needed from here, and double-click on the Windows Installer package to launch the setup process (Figure 1):
Figure 1: Installing MDT 2008 Update 1
A complete install of both tools and documentation is selected by default (Figure 2):
Figure 2: Select installation options
Once you have finished installing MDT, launch the Deployment Workbench by clicking Start, All Programs, Microsoft Deployment Toolkit, Deployment Workbench (Figure 3):
Figure 3: The MDT Deployment Workbench
The Workbench is the integrated workspace from which you can perform all of your deployment-related tasks. As you can see from the above figure, the Workbench has four main areas:
Information Center – Provides access to the Getting Started guide and other MDT documentation, news updates concerning MDT, and the latest version of MDT components (see Figure 5 below):
Distribution Share – This is where you bring together your operating system installation files and package files, your application installation files, and any out-of-box device drivers you will need to perform your deployment.
Task Sequences – This is where you define the steps that will take place during your deployment (essentially configuring your answer file).
Deploy – this is where you create your deployment points (the actual sets of OS, app and driver files needed for performing your deployments) and the MDT database (stores configuration information used for customizing your deployments).
Figure 4: The Components node of the Workbench
Expert Guidance in all computer related problems including software, hardware and networking. Find your solutions with Expert Solutions.
Expert Solutions
Expert Solution Search
Loading
Expert Solution Finder
Sunday, December 26, 2010
Thursday, December 9, 2010
Computer Restarts
We have received lot many problems from our readers complaining that their computer restarts abruptly. It seems like that the computer restarts without any reason, but it is not so, every-time your computer restarts abruptly, there must be some or other reason that you might not have noticed.
In this post we will look into those reasons and the possible solutions to fix computer restart problem. So lets have a look at the possible reasons:
Computer restart due to overheating
Computer restart due to faulty RAM
Computer restart due to faulty Hard-disk
Computer restart due to overheating up of hard-disk
Computer restart on attaching some external USB device
Computer restart due to other hardware problem
Some software causing operating system crash causes computer restart
There may be some rare typical reasons also, but let us focus on these common reasons and lets have a look on how to fix computer restart problem because of above reasons.
Going one by one, lets see how these problems can be fixed:
Computer restart due to overheating:
Computer restarts due to over-heating when the processor fan goes faulty. See this post for detailed solution.
Computer restart due to faulty RAM:
Computer restarts abruptly if RAM goes faulty, or if you install some in-compatible RAM or more than one RAM modules of different frequency or type. See the RAM upgrade post for details.
Computer restart due to faulty Hard-disk:
Faulty hard disk is one of the most common reasons for abrupt computer restart. Run a hard disk scan to fix this issue. If there are bad-sectors on your hard-disk, its the time to get it replaced.
Computer restart due to overheating up of hard-disk:
If there is not proper ventilation around your computer, the hard disk may also reach temperatures where it starts to malfunction and computer restarts in some of these cases. The fix is to keep the computer at a ventilated place. Also installing some cabinet fans also solves this problem to big extent.
Computer restart on attaching some external USB device:
I have experienced that when I attached my memory-card-reader to my computer, the computer restarted. I tried it again, it again re-started, it was not a co-incidence, it was a faulty device. So the fix is, remove all external USB devices and insert one by one, and see which device is causing problem.
Computer restart due to other hardware problem:
Computer restart problem is also caused by faulty motherboard sometimes,for example my desktop’s BIOS went corrupt a few weeks back. But the chances of motherboard are relatively low, so if nothing else seems to help, get the motherboard checked by hardware vendor or technician.
Some software causing operating system crash causes computer restart:
Sometimes a software can also be the culprit behind the computer restart. If you have recently installed any new application or game, and computer has started to restart when using that application or game, you need to un-install it to fix the issue.
everything's gone. Be it a random reboot, or the infamous "blue screen of death", it's very, very frustrating.
The problem is that this can be caused by so many things, it's difficult to nail it down quickly.
Let's run through some of the possibilities, and what I'd do.
•
Malware
You've touched on one thing I always look at first: viruses and spyware. Do make sure that your scanners are running, and are being regularly updated with the latest databases of spyware and virus definitions. For anti-spyware tools, that should happen daily - anti-spyware tools typically do so less often.
Software
If you're running Windows 9x (meaning Windows 95, 98 or Me), there's about a 50/50 chance that the problem is a software problem. Because of how their design evolved, those versions of Windows were all somewhat more vulnerable to crashing bugs in the software. A poorly written device driver, or even an application bug, could in the worst case scenario cause a system reboot or blue screen.
If you're running Windows XP (or Windows NT, 2000 or 2003), the system is designed more robustly - meaning that it's more difficult for these types of problems to result in a random reboot or crash. Not impossible, just much less likely.
If you've made a recent change to your system, perhaps installed a new software package, or a new piece of hardware, and these problems started happening thereafter, that's a likely clue. Depending on the software or hardware, my first reaction would be to look to the vendor for reported problems and possible updates. In particular, device drivers are the most likely to cause crashes and reboots without warning.
As I said, software related reboots and blue screens have become more rare under Windows XP. However you should still make sure that your system is as up-to-date as possible, particularly including drivers for recently installed hardware.
"... Which leads to the ultimate predicament... it could be anything. Quite literally.I know that many folks have become suspicious of Windows Automatic Update for various reasons, but I've not heard of any crashes resulting its use. I still recommend it as the best way to keep Windows up to date.
Hardware
I will say that if your computer is still under warranty, you need to talk to the manufacturer first. You should exhaust all your options in getting them to repair a failing machine before you head out on your own and possibly void your warranty.
Naturally, if you've recently installed new hardware, that's a possible clue. You might consider removing it temporarily to see if the problem abates. If it does, it points to either the device itself being the cause, or perhaps the system power supply, as I'll discuss in just a minute.
If your computer has been running fine for some time, and you haven't installed any new hardware or software recently, then my tendency would be to start suspecting various hardware components.
Perhaps the most common are failing fans. The fans that move air through your machine to keep it cool are critical to its operation, and are often the first to fail - either due to accumulated dust and dirt, or simple age. When the fan stops working, the machine overheats, and when the machine overheats - it crashes. Randomly.
Next most common is a failing power supply. Power supplies can fail slowly - meaning that they can become 'marginal' before they fail completely. And the symptoms of a marginal power supply are - you guessed it - random crashes. This is one of those cases where replacing the power supply (or having someone replace it for you) is often an inexpensive test. Particularly if you've added more hardware to your system over time, you may simply be demanding more of the power supply than it was designed to provide, so an upgrade might well be in order as well.
I have this gut feeling that memory is failing just a little more frequently than in the past. I won't speculate as to why, or even if my observation is accurate. The good news is that there are tools specifically designed for testing memory. Memtest86 is one such tool that performs an exhaustive test of your computer's memory. Microsoft also provides a Windows memory Diagnostic. Both tools run from a bootable floppy or CD (Windows cannot be running for the tests to exercise all memory), and both tools are free.
Naturally, it's also possible that the fault lies elsewhere. Your motherboard, an add-in card, even your disk drives or video card. Which leads to the ultimate predicament ... it could be anything. Quite literally.
One of the more common repair techniques is to make an educated guess at what might be wrong, replace that component, and keep repeating until all the components of your computer have been replaced, or the problem goes away.
Unfortunately, doing that is beyond the resources or desire of most computer owners.
My approach
So here's what I would do, when faced with a randomly rebooting computer:
Yes, I would consider upgrading to Windows XP, if the machine is capable of it.
Make sure that anti-virus and anti-spyware utilities are running and up-to-date.
Make sure that the operating system and all device drivers are as up-to-date as possible.
Run a memory diagnostic such as Memtest86 or Windows memory Diagnostic.
Run a hard disk diagnostic such as SpinRite.
Run a motherboard temperature monitoring tool such as Motherboard Monitor - it's a free tool that will report your CPU's temperature among other things, and will let you see if the machine is overheating for some reason.
At this point I've done pretty much everything I can that doesn't involve opening the computer. If the problem isn't evident or resolved, we need to get a little more serious. This might also be the time for some to simply take their computer in to a technician for diagnosis.
Next, I'd open up the computer and:
Carefully vacuum all the dust out of the machine.
Make sure that the fans which are accessible are running properly. If not, I replace them. If the machine doesn't crash as quickly with the cover off, that's often a sign of overheating.
Remove as many optional hardware components as possible that would still allow the machine to run. If the problem disappeared, I would re-install components until it reappeared, and then remove other components to make sure that the problem was associated with only a specific component.
Re-seat all remaining and accessible connectors and expansion cards - sometimes problems are as simple as a loose connection.
At this point we've done pretty much everything we can with what we have on hand. Next up, we start spending money (or, perhaps if you're a geek, pulling from your spare parts bin), and go down the "replace parts until it works" path. This is another jump off point for many - it's definitely easier to simply take the computer in to a technician for diagnosis.
I'd replace the power supply first. Unless there's other data that says the problem is likely to be elsewhere, I'm just playing the odds here. If I went this far, and I planned to keep the computer for some time, I'd also consider upgrading to a higher wattage supply at the same time. Replacing a power supply is only moderately difficult.
Next up, would be the motherboard. This is a bit of work, as it often involves tearing the entire computer apart.
Lastly, I'd consider replacing the computer.
In reality, unless you're really interested in playing with the hardware and trying the "replace it 'til it works" approach, I'd recommend skipping this last set of items completely and taking it into a repair shop to let them figure it out.
And, naturally, before you do so, it might also be time for a cost/benefit analysis: will it be cheaper or more effective to simply replace the computer than to fix it? I'm not at all saying that it will be - it depends on the availability and going rates for computer repair in your area, and the potential cost of fixing whatever is broken. But this is the time to at least do the math and compare.
In this post we will look into those reasons and the possible solutions to fix computer restart problem. So lets have a look at the possible reasons:
Computer restart due to overheating
Computer restart due to faulty RAM
Computer restart due to faulty Hard-disk
Computer restart due to overheating up of hard-disk
Computer restart on attaching some external USB device
Computer restart due to other hardware problem
Some software causing operating system crash causes computer restart
There may be some rare typical reasons also, but let us focus on these common reasons and lets have a look on how to fix computer restart problem because of above reasons.
Going one by one, lets see how these problems can be fixed:
Computer restart due to overheating:
Computer restarts due to over-heating when the processor fan goes faulty. See this post for detailed solution.
Computer restart due to faulty RAM:
Computer restarts abruptly if RAM goes faulty, or if you install some in-compatible RAM or more than one RAM modules of different frequency or type. See the RAM upgrade post for details.
Computer restart due to faulty Hard-disk:
Faulty hard disk is one of the most common reasons for abrupt computer restart. Run a hard disk scan to fix this issue. If there are bad-sectors on your hard-disk, its the time to get it replaced.
Computer restart due to overheating up of hard-disk:
If there is not proper ventilation around your computer, the hard disk may also reach temperatures where it starts to malfunction and computer restarts in some of these cases. The fix is to keep the computer at a ventilated place. Also installing some cabinet fans also solves this problem to big extent.
Computer restart on attaching some external USB device:
I have experienced that when I attached my memory-card-reader to my computer, the computer restarted. I tried it again, it again re-started, it was not a co-incidence, it was a faulty device. So the fix is, remove all external USB devices and insert one by one, and see which device is causing problem.
Computer restart due to other hardware problem:
Computer restart problem is also caused by faulty motherboard sometimes,for example my desktop’s BIOS went corrupt a few weeks back. But the chances of motherboard are relatively low, so if nothing else seems to help, get the motherboard checked by hardware vendor or technician.
Some software causing operating system crash causes computer restart:
Sometimes a software can also be the culprit behind the computer restart. If you have recently installed any new application or game, and computer has started to restart when using that application or game, you need to un-install it to fix the issue.
everything's gone. Be it a random reboot, or the infamous "blue screen of death", it's very, very frustrating.
The problem is that this can be caused by so many things, it's difficult to nail it down quickly.
Let's run through some of the possibilities, and what I'd do.
•
Malware
You've touched on one thing I always look at first: viruses and spyware. Do make sure that your scanners are running, and are being regularly updated with the latest databases of spyware and virus definitions. For anti-spyware tools, that should happen daily - anti-spyware tools typically do so less often.
Software
If you're running Windows 9x (meaning Windows 95, 98 or Me), there's about a 50/50 chance that the problem is a software problem. Because of how their design evolved, those versions of Windows were all somewhat more vulnerable to crashing bugs in the software. A poorly written device driver, or even an application bug, could in the worst case scenario cause a system reboot or blue screen.
If you're running Windows XP (or Windows NT, 2000 or 2003), the system is designed more robustly - meaning that it's more difficult for these types of problems to result in a random reboot or crash. Not impossible, just much less likely.
If you've made a recent change to your system, perhaps installed a new software package, or a new piece of hardware, and these problems started happening thereafter, that's a likely clue. Depending on the software or hardware, my first reaction would be to look to the vendor for reported problems and possible updates. In particular, device drivers are the most likely to cause crashes and reboots without warning.
As I said, software related reboots and blue screens have become more rare under Windows XP. However you should still make sure that your system is as up-to-date as possible, particularly including drivers for recently installed hardware.
"... Which leads to the ultimate predicament... it could be anything. Quite literally.I know that many folks have become suspicious of Windows Automatic Update for various reasons, but I've not heard of any crashes resulting its use. I still recommend it as the best way to keep Windows up to date.
Hardware
I will say that if your computer is still under warranty, you need to talk to the manufacturer first. You should exhaust all your options in getting them to repair a failing machine before you head out on your own and possibly void your warranty.
Naturally, if you've recently installed new hardware, that's a possible clue. You might consider removing it temporarily to see if the problem abates. If it does, it points to either the device itself being the cause, or perhaps the system power supply, as I'll discuss in just a minute.
If your computer has been running fine for some time, and you haven't installed any new hardware or software recently, then my tendency would be to start suspecting various hardware components.
Perhaps the most common are failing fans. The fans that move air through your machine to keep it cool are critical to its operation, and are often the first to fail - either due to accumulated dust and dirt, or simple age. When the fan stops working, the machine overheats, and when the machine overheats - it crashes. Randomly.
Next most common is a failing power supply. Power supplies can fail slowly - meaning that they can become 'marginal' before they fail completely. And the symptoms of a marginal power supply are - you guessed it - random crashes. This is one of those cases where replacing the power supply (or having someone replace it for you) is often an inexpensive test. Particularly if you've added more hardware to your system over time, you may simply be demanding more of the power supply than it was designed to provide, so an upgrade might well be in order as well.
I have this gut feeling that memory is failing just a little more frequently than in the past. I won't speculate as to why, or even if my observation is accurate. The good news is that there are tools specifically designed for testing memory. Memtest86 is one such tool that performs an exhaustive test of your computer's memory. Microsoft also provides a Windows memory Diagnostic. Both tools run from a bootable floppy or CD (Windows cannot be running for the tests to exercise all memory), and both tools are free.
Naturally, it's also possible that the fault lies elsewhere. Your motherboard, an add-in card, even your disk drives or video card. Which leads to the ultimate predicament ... it could be anything. Quite literally.
One of the more common repair techniques is to make an educated guess at what might be wrong, replace that component, and keep repeating until all the components of your computer have been replaced, or the problem goes away.
Unfortunately, doing that is beyond the resources or desire of most computer owners.
My approach
So here's what I would do, when faced with a randomly rebooting computer:
Yes, I would consider upgrading to Windows XP, if the machine is capable of it.
Make sure that anti-virus and anti-spyware utilities are running and up-to-date.
Make sure that the operating system and all device drivers are as up-to-date as possible.
Run a memory diagnostic such as Memtest86 or Windows memory Diagnostic.
Run a hard disk diagnostic such as SpinRite.
Run a motherboard temperature monitoring tool such as Motherboard Monitor - it's a free tool that will report your CPU's temperature among other things, and will let you see if the machine is overheating for some reason.
At this point I've done pretty much everything I can that doesn't involve opening the computer. If the problem isn't evident or resolved, we need to get a little more serious. This might also be the time for some to simply take their computer in to a technician for diagnosis.
Next, I'd open up the computer and:
Carefully vacuum all the dust out of the machine.
Make sure that the fans which are accessible are running properly. If not, I replace them. If the machine doesn't crash as quickly with the cover off, that's often a sign of overheating.
Remove as many optional hardware components as possible that would still allow the machine to run. If the problem disappeared, I would re-install components until it reappeared, and then remove other components to make sure that the problem was associated with only a specific component.
Re-seat all remaining and accessible connectors and expansion cards - sometimes problems are as simple as a loose connection.
At this point we've done pretty much everything we can with what we have on hand. Next up, we start spending money (or, perhaps if you're a geek, pulling from your spare parts bin), and go down the "replace parts until it works" path. This is another jump off point for many - it's definitely easier to simply take the computer in to a technician for diagnosis.
I'd replace the power supply first. Unless there's other data that says the problem is likely to be elsewhere, I'm just playing the odds here. If I went this far, and I planned to keep the computer for some time, I'd also consider upgrading to a higher wattage supply at the same time. Replacing a power supply is only moderately difficult.
Next up, would be the motherboard. This is a bit of work, as it often involves tearing the entire computer apart.
Lastly, I'd consider replacing the computer.
In reality, unless you're really interested in playing with the hardware and trying the "replace it 'til it works" approach, I'd recommend skipping this last set of items completely and taking it into a repair shop to let them figure it out.
And, naturally, before you do so, it might also be time for a cost/benefit analysis: will it be cheaper or more effective to simply replace the computer than to fix it? I'm not at all saying that it will be - it depends on the availability and going rates for computer repair in your area, and the potential cost of fixing whatever is broken. But this is the time to at least do the math and compare.
Tuesday, December 7, 2010
Grid Error Message
Hi there, i have recently installed Grid on my computer, and applied the latest patch, however whenever i try and launch the game it trys to load then just crasshes with an error report message.
This happens everytime.
I have tried everything and nothing seems to be working, any ideas please?
My system specs are:
Windows XP Professional
Intel Core 2 Quad CPU
2.40ghz
2.00gb ram
Geforce 8800 GTS
i have made some progress on this, i have a creative soundcard and have been readiong these forums for a solution, it now launches when i disable the sound card, which is great becuase it works, but rubbish as i have no sound.
I have tried searching for the adi_oal.dll but cant find it anywhere on my comp, i am on Windows XP, any idea where it is?
I am dealing with a problem in datagrid. Sometimes when I select or drag the datagrid column I get an error message saying "Index out of range exception". Can someone help me in explaining the reason for that error.Thanks in advance
hi friend //this code for fill datagrid withhelp of dataset
dbDataSet = new DataSet();
dbDataSet = function();
datagrid.DataSource = dbDataSet;
dtgGodown.TableStyles.Clear();
DataGridTableStyle dtgTs = new DataGridTableStyle();
dtgTs.MappingName = "tablename";
datagrid.TableStyles.Add(dtgTs);
int nGridRowCount = dbDataSet.Tables[0].Rows.Count;
if(nGridRowCount != 0)
{
datagrid.NavigateTo(0,"tablename");
datagrid.Select(0);
datagrid.TableStyles["tablename"].SelectionBackColor = Color.Gainsboro;
datagrid.TableStyles["tablename"].SelectionForeColor = Color.Red;
datagrid.TableStyles["tablename"].GridColumnStyles["fieldname..."].Width = 162;
datagrid.TableStyles["tablename"].GridColumnStyles["fieldname.."].Width = 0;
}
/////////////////////////////
clickevent
/////////////////////
if (nGridRowCount != 0)
{
strFlag = "Edit";
lable.Text = datagrid[datagrid.CurrentCell.RowNumber,1 ].ToString();
txtbox.Text = datagrid[datagrid.CurrentCell.RowNumber, 0].ToString();
}
To trap the record that is being accessed in a DataGrid Web server control, you use the DataKeys collection of DataGrid on an ItemCommand event, and then pass the ItemIndex property as a key to the DataKey collection. When you click a link to move to the next page (or to a new page) in the DataGrid, you may receive the following error message:
When you click a link to move to the next page (or to a new page) in the DataGrid, the ItemCommand event is invoked. The value of the ItemIndex property is -1 in the ItemCommand event. You may receive an error when you pass the ItemIndex property as a key to retrieve the value from the DataKey collection because the DataKey collection is zero bound.
private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e){ // If Not navigating to Next Page, show the CategoryID in the text box. if (e.Item.ItemIndex > -1) { // Get the CategoryID of the Row Selected in the DataGrid. TextBox1.Text = DataGrid1.DataKeys[e.Item.ItemIndex].ToString(); }}http://support.microsoft.com/kb/813832
ASP.NET Ajax Grid and Pager
Introduction
This article will show you how to create an AJAX Grid and a generic pager, which mimics the built-in GridView control on the client side.
Features
The Control(s) Provides:
Able to bind to any web service call that returns an array.
A GridView like API on the client side.
Able to AutoGenerate Columns based upon the dataSource.
Support for Sorting and Paging where developer can spawn his/her own logic.
Full VS Design Time Support.
Supports Column Drag and Drop.
Compatible with all major browsers including IE, Firefox, Opera and Safari.
Prerequiste
This is not a beginner’s guide. If you are new to ASP.NET AJAX or not familiar with Client-Centric or Server-Centric Development model, I strongly recommend you visit http://ajax.asp.net. To run the solution you must have:
Visual Studio 2005 or Visual Web Developer.
Latest Version (v1.0) of ASP.NET AJAX.
SQL Server 2005 (At least Express Edition) for running the sample.
Northwind Database (You can download the sql script from here).
Background
ASP.NET AJAX is a great platform to develop rich user experience web applications. The most amazing part is that it replaces the traditional page postback refresh model. We can easily add an UpdatePanel (A Part of Server Centric Development model) in the updatable part of a page to remove the regular page postback. But the problem with an UpdatePanel is that it not only returns the updated data but also returns the HTML tags of that updated part. This is not an issue if you are developing small or mid size applications where performance and network bandwidth is not a concern. However if you are developing a large system where performance and network bandwidth matters, then definitely you want to send only the updated data without the unnecessary HTML tags.
When developing a database application it is a common requirement to show data in a tabular format with sorting and paging. ASP.NET has two first class controls for this purpose, the DataGrid and the GridView. But the problem with these controls there is no object model in the client side, which we can utilize with JavaScript. There is no way we can call a Web Service or Server side method and bind the result with it in the client side. Developers often have to write reparative DHTML code to render the tabular data.
The AJAX Grid
The provided AJAX Grid solves the above problem. Developer can easily bind the result of a Web Service or Server Side method calls in the client side. It also exposes a similar API like DataGrid/GridView in client side that most of the ASP.NET developers are already familiar with.
Data Binding
When binding data we set the DataSource of the target control and call the DataBind() method. The same steps are required for the AJAX Grid. The following lines show the Suppliers table records from the Northwind database.
Code Listing 1: JavaScript
view sourceprint?01.
02.function pageLoad()
03.{
04.
var grid = $find('grid'); // Get the reference of the Client Side Component
05.
DataService.GetAllSupplier
06.
(
07.
function(suppliers)
08.
{
09.
grid.set_dataSource(suppliers);
10.
grid.dataBind();
11.
}
12.
);
13.}
Code Listing 2: AJAX
view sourceprint?1.
2.
3.
4.
5.
6.
Figure 1: Output
This is a simple page, which uses a ScriptManager with a WebService reference and an AJAX Grid. In the pageLoad() (A special event which is fired by the ASP.NET AJAX Library every time the page is loaded) event we are getting the reference of the AJAX Grid by using the $find method (A shortcut method to find the Client Side Component, please do not confuse Client Side Component with regular DOM element, to get a DOM element reference use $get) statements and then we are setting the dataSource that the web service call returns and finally calls the dataBind() method. As you can see, the output is the same as we would set up a DataGrid/GridView with the default setting.
Styling
The above example shows the data in a plain vanilla style, certainly we do not want show the data in this way rather we would like to add some styling property. AJAX Grid similarly exposes CssClass, HeaderCssClass, RowCssClass, AlternatingRowCssClass and SelectedRowCssClass to do the same styling as the DataGid/GridView controls. Once we apply these styles the above example output looks like the following.
Figure 2: Output with Styles
The Supplier.aspx of the attached sample has full source code of the above two examples.
The Column Collection
When showing the tabular data we certainly like to add more control such as hiding a column, showing a different header text, alignment, allow sorting, setting column width etc. In AJAX Grid we can easily define the column collection in declarative model like the following:
Code Listing 3: AJAX Grid with Columns
view sourceprint?01. 02.RowCssClass="gridRow" AlternatingRowCssClass="gridAltRow" SortColumn="CompanyName"
03.SortOrderAscendingImage="Images/up.gif" SortOrderDescendingImage="Images/dn.gif">
04.
05.
06.
Nowrap="True"/>
07.
08.
09.
10.
11.
12.
Nowrap="True"/>
13.
14.
15.
16.
The AJAX Gird Column contains the following important properties:
HeaderText: Same as in the DataGrid/GridView.
DataField: Same as in the DataGrid/GridView.
Sortable: If true, the header text will be displayed as a hyperlink instead of text.
SortField: Must be specified if SortField is different from DataField.
FormatString: Same as in the DataGrid/GridView.
Sorting
The AJAX Grid also supports sorting in the same way as the DataGrid/GridView control. When a column header is clicked it raises the Sort event, which we have to subscribe. To show the current sort order we have to set the SortOrderAscendingImage and SortOrderDescendingImage property of AJAX Grid. In order to get the current sort column and order we can check the SortColumn and SortOrder property. The following shows how to add sorting support in the AJAX Grid which shows the Customers table of Northwind database.
Code Listing 4: AJAX Grid with Columns
view sourceprint?01.function pageLoad()
02.{
03.
// Getting the reference of the Client Components and
04.
// attaching the event handlers
05.
_grid = $find('grid');
06.
_grid.add_sort(sorted);
07.}
08.
09.function sorted(sender, e)
10.{
11.
// Set the SortColum and SortOrder of the Grid so
12.
// that it can properly render current sort column and
13.
// and the associated image
14.
15.
_grid.set_sortColumn(e.get_sortColumn());
16.
_grid.set_sortOrder(e.get_sortOrder());
17.
18.
// Here we can call the WebService with the new SortColumn and SortOrder
19.}
Figure 3: AJAX Grid Sorted
The Customer.aspx of the attached sample has the full source code of the sorting example.
Selecting/Deleting Rows
To show the Select and Delete link like in the DataGrid/GridView we have set the ShowSelectLink and ShowDeleteLink property to true. Once a row is selected it will raise the SelectedIndexChange event. The same thing happens when the delete link is clicked; it raises the RowDelete event. Both of these events pass the CommandName and CommandArgument but for this the DataKeyName must to be set. For example if we set the DataKeyName to the primary key of a table in these events it will have the primary key value as CommandArgument. You can also select a row by using the SelectedIndex property or the Select() method. To deselect a row use the ResetSelection() method.
The RowDataBound Event
In the RowDataBound event we can do some special processing before the data is bound. For example when showing the Products table of Northwind database we can change the background color to red that Unit in Stock is less than 10. Another example could be that our Web Service returns the Product's CategoryID but we want to show the category name instead of that CategoryID. These kinds of changes can be done in this event. This event passes the binding row and the current data item that it is binding. The following shows how to bind this event and do the special processing.
Code Listing 5: RowDataBound
view sourceprint?01.function pageLoad()
02.{
03.
// Getting the reference of the Client Components
04.
// and attaching the event handlers
05.
_grid = $find('grid');
06.
_grid.add_rowDataBound(rowDataBound);
07.}
08.
09.function rowDataBound(sender, e)
10.{
11.
var product = e.get_dataItem();
12.
13.
var tdCategory = e.get_tableRow().cells[2];
14.
var categoryName = getCategoryName(product.CategoryID);
15.
tdCategory.innerHTML = categoryName;
16.
17.
var tdUnitsInStock = e.get_tableRow().cells[5];
18.
if (product.UnitsInStock < 10)
19.
{
20.
tdUnitsInStock.style.backgroundColor = '#ff0000';
21.
}
22.}
Figure 4: RowDataBound
The Product.aspx of the attached sample has the full source code of the RowDataBound event example.
Paging
When working with large tables we often required to use paging. Although the DataGrid/GridView has built-in support for paging they are pretty much useless. Most developers often refuse to use the built-in functionality and use their own custom logic which usually takes a start index, page size and other additional parameters and in turn returns only the paged records with the total number of records. The sample DataService.asmx contains some of the methods (GetCustomerList, GetProductList) which contain the custom paging logic. Usually a Pager shows the page numbers, next/previous, first/last page links. The following shows how to implement a pager control.
Code Listing 6: AJAX Grid Pager JavaScript
view sourceprint?01.function pageLoad()
02.{
03.
// Getting the reference of the Client Components
04.
// and attaching the event handlers
05.
06.
_grid = $find('grid');
07.
_grid.add_sort(sorted);
08.
09.
_pager = $find('pager');
10.
_pager.add_pageChange(pageChanged);
11.
12.
//Getting the reference of the DOM elements
13.
_message = $get('message');
14.
15.
loadCustomers();
16.}
17.
18.function sorted(sender, e)
19.{
20.
// Set the SortColum and SortOrder of the Grid so that
21.
// it can properly render current sort column
22.
// and the associated image
23.
24.
_grid.set_sortColumn(e.get_sortColumn());
25.
_grid.set_sortOrder(e.get_sortOrder());
26.
27.
// need to reset the current page as sorting has been changed
28.
_pager.set_currentPage(1);
29.
30.
loadCustomers();
31.}
32.
33.function pageChanged(sender, e)
34.{
35.
// Set the new page as current page
36.
_pager.set_currentPage(e.get_newPage());
37.
loadCustomers();
38.}
39.
40.function loadCustomers()
41.{
42.
// Calculating the startindex
43.
var startIndex = ((_pager.get_currentPage()-1) * _pager.get_rowPerPage());
44.
45.
// Need to convert the sortoder which our WS can understand
46.
// This needs to be on one line. Its been wrapped to display better in this article.
47.
var sortOrder = (_grid.get_sortOrder() == Ajax.Controls.GridSortOrder.Descending)
48.
? 'DESC' : 'ASC';
49.
50.
_message.innerHTML = "
53.
_message.style.display = "";
54.
55.
DataService.GetCustomerList
56.
(
57.
startIndex,
58.
_pager.get_rowPerPage(),
59.
_grid.get_sortColumn(),
60.
sortOrder,
61.
function(pagedResult)
62.
{
63.
var total = 0;
64.
var customers = null;
65.
66.
if (pagedResult != null)
67.
{
68.
total = pagedResult.Total;
69.
customers = pagedResult.Rows;
70.
}
71.
72.
_grid.set_dataSource(customers);
73.
_grid.dataBind();
74.
75.
_pager.set_rowCount(total);
76.
77.
_message.innerHTML = '';
78.
_message.style.display = 'none';
79.
},
80.
function(exception)
81.
{
82.
_message.innerHTML = '' + exception.get_message() + '';
83.
}
84.
);
85.}
Code Listing 7: AJAX Grid Pager ASPX
view sourceprint?01.
Figure 5: AJAX Grid Pager
The followings are some of the important properties of the AJAX Pager:
ShowInfo: When true, shows the info such as Page 1 of 10. The default value is false.
ShowFirstAndLast: When true, shows the first and last Link. The default value is true.
FirstText: The text which will be displayed as link for the first page. The Default value is <<
LastText: The text which will be displayed as link for the last page. The Default value is >>
ShowPreviousAndNext: When true, shows the Previous and Next Link. The default value is false.
ShowNumbers: When true, shows the page numbers as link. The default value is true.
RowPerPage: The Number of row that each page contains. The default value is 10.
CurrentPage: The currentpage that the pager is showing.
HideOnSinglePage: The control will not be rendered if it founds there is only one page.
ShowTip: When true, a tooltip will appears on hovering on any of the links.
InfoCssClass: Styling property for the info part.
CurrentPageCssClass: Styling property for the current page.
OtherPageCssClass: Styling property for other pages.
The AJAX Pager contains only one event PageChange that the developers have to subscribe to load the new page data. I have excluded the Pager from the Grid so that it can be utilize in with other controls that show tabular data.
Both the Customer.aspx and Product.aspx of the attached sample has full source code of the Paging example.
Drag and Drop
Drag and Drop is an essential part of any Rich Web Application and thus it has become a common feature for Web 2.0 applications. Certianly Pageflakes is one of the best candidates for utlizing drag and drop. The Ajax Grid has built-in support for column drag and drap. Just set the AllowDragAndDrop property for any Column to true and it will be drag and dropable. The following screenshot shows the implemented version of a drag and drop in the Customers table of the Northwind database:
Figure 5: AJAX Grid Drag and Drop
The Ajax Grid raises the ColumnDragStarted when the column drag started and ColumnDropped upon dropping the column. The following code shows how to track the column and drag and drop in these events.
Code Listing 8: AJAX Grid Drag and Drop
view sourceprint?01.function pageLoad()
02.{
03.
_grid = $find('grid');
04.
_grid.add_columnDragStart(columnDragStart);
05.
_grid.add_columnDropped(columnDropped);
06.}
07.
08.function columnDragStart(sender, e)
09.{
10.
alert(e.get_column().headerText); // the event passes the column reference
11.}
12.
13.function columnDropped(sender, e)
14.{
15.
// this event also passes the column reference with old and new index
16.
alert(e.get_column().headerText);
17.
alert(e.get_oldIndex());
18.
alert(e.get_newIndex());
19.}
We can also use the built-in ProfileService to persist the columns position, so that in the next visit the columns positioning is same as the user left it in the last visit.
Summary
Microsoft ASP.NET AJAX is great platform to develop web application but currently it is lacking of Client Side Components especially which works with data. Although you will find 30+ controls in ASP.NET Ajax ToolKit but most of them are mainly extender, which extends existing server side ASP.NET Controls. Certainly we can develop these kinds of controls to enrich it.
This happens everytime.
I have tried everything and nothing seems to be working, any ideas please?
My system specs are:
Windows XP Professional
Intel Core 2 Quad CPU
2.40ghz
2.00gb ram
Geforce 8800 GTS
i have made some progress on this, i have a creative soundcard and have been readiong these forums for a solution, it now launches when i disable the sound card, which is great becuase it works, but rubbish as i have no sound.
I have tried searching for the adi_oal.dll but cant find it anywhere on my comp, i am on Windows XP, any idea where it is?
I am dealing with a problem in datagrid. Sometimes when I select or drag the datagrid column I get an error message saying "Index out of range exception". Can someone help me in explaining the reason for that error.Thanks in advance
hi friend //this code for fill datagrid withhelp of dataset
dbDataSet = new DataSet();
dbDataSet = function();
datagrid.DataSource = dbDataSet;
dtgGodown.TableStyles.Clear();
DataGridTableStyle dtgTs = new DataGridTableStyle();
dtgTs.MappingName = "tablename";
datagrid.TableStyles.Add(dtgTs);
int nGridRowCount = dbDataSet.Tables[0].Rows.Count;
if(nGridRowCount != 0)
{
datagrid.NavigateTo(0,"tablename");
datagrid.Select(0);
datagrid.TableStyles["tablename"].SelectionBackColor = Color.Gainsboro;
datagrid.TableStyles["tablename"].SelectionForeColor = Color.Red;
datagrid.TableStyles["tablename"].GridColumnStyles["fieldname..."].Width = 162;
datagrid.TableStyles["tablename"].GridColumnStyles["fieldname.."].Width = 0;
}
/////////////////////////////
clickevent
/////////////////////
if (nGridRowCount != 0)
{
strFlag = "Edit";
lable.Text = datagrid[datagrid.CurrentCell.RowNumber,1 ].ToString();
txtbox.Text = datagrid[datagrid.CurrentCell.RowNumber, 0].ToString();
}
To trap the record that is being accessed in a DataGrid Web server control, you use the DataKeys collection of DataGrid on an ItemCommand event, and then pass the ItemIndex property as a key to the DataKey collection. When you click a link to move to the next page (or to a new page) in the DataGrid, you may receive the following error message:
When you click a link to move to the next page (or to a new page) in the DataGrid, the ItemCommand event is invoked. The value of the ItemIndex property is -1 in the ItemCommand event. You may receive an error when you pass the ItemIndex property as a key to retrieve the value from the DataKey collection because the DataKey collection is zero bound.
private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e){ // If Not navigating to Next Page, show the CategoryID in the text box. if (e.Item.ItemIndex > -1) { // Get the CategoryID of the Row Selected in the DataGrid. TextBox1.Text = DataGrid1.DataKeys[e.Item.ItemIndex].ToString(); }}http://support.microsoft.com/kb/813832
ASP.NET Ajax Grid and Pager
Introduction
This article will show you how to create an AJAX Grid and a generic pager, which mimics the built-in GridView control on the client side.
Features
The Control(s) Provides:
Able to bind to any web service call that returns an array.
A GridView like API on the client side.
Able to AutoGenerate Columns based upon the dataSource.
Support for Sorting and Paging where developer can spawn his/her own logic.
Full VS Design Time Support.
Supports Column Drag and Drop.
Compatible with all major browsers including IE, Firefox, Opera and Safari.
Prerequiste
This is not a beginner’s guide. If you are new to ASP.NET AJAX or not familiar with Client-Centric or Server-Centric Development model, I strongly recommend you visit http://ajax.asp.net. To run the solution you must have:
Visual Studio 2005 or Visual Web Developer.
Latest Version (v1.0) of ASP.NET AJAX.
SQL Server 2005 (At least Express Edition) for running the sample.
Northwind Database (You can download the sql script from here).
Background
ASP.NET AJAX is a great platform to develop rich user experience web applications. The most amazing part is that it replaces the traditional page postback refresh model. We can easily add an UpdatePanel (A Part of Server Centric Development model) in the updatable part of a page to remove the regular page postback. But the problem with an UpdatePanel is that it not only returns the updated data but also returns the HTML tags of that updated part. This is not an issue if you are developing small or mid size applications where performance and network bandwidth is not a concern. However if you are developing a large system where performance and network bandwidth matters, then definitely you want to send only the updated data without the unnecessary HTML tags.
When developing a database application it is a common requirement to show data in a tabular format with sorting and paging. ASP.NET has two first class controls for this purpose, the DataGrid and the GridView. But the problem with these controls there is no object model in the client side, which we can utilize with JavaScript. There is no way we can call a Web Service or Server side method and bind the result with it in the client side. Developers often have to write reparative DHTML code to render the tabular data.
The AJAX Grid
The provided AJAX Grid solves the above problem. Developer can easily bind the result of a Web Service or Server Side method calls in the client side. It also exposes a similar API like DataGrid/GridView in client side that most of the ASP.NET developers are already familiar with.
Data Binding
When binding data we set the DataSource of the target control and call the DataBind() method. The same steps are required for the AJAX Grid. The following lines show the Suppliers table records from the Northwind database.
Code Listing 1: JavaScript
view sourceprint?01.
02.function pageLoad()
03.{
04.
var grid = $find('grid'); // Get the reference of the Client Side Component
05.
DataService.GetAllSupplier
06.
(
07.
function(suppliers)
08.
{
09.
grid.set_dataSource(suppliers);
10.
grid.dataBind();
11.
}
12.
);
13.}
Code Listing 2: AJAX
view sourceprint?1.
2.
3.
4.
5.
6.
Figure 1: Output
This is a simple page, which uses a ScriptManager with a WebService reference and an AJAX Grid. In the pageLoad() (A special event which is fired by the ASP.NET AJAX Library every time the page is loaded) event we are getting the reference of the AJAX Grid by using the $find method (A shortcut method to find the Client Side Component, please do not confuse Client Side Component with regular DOM element, to get a DOM element reference use $get) statements and then we are setting the dataSource that the web service call returns and finally calls the dataBind() method. As you can see, the output is the same as we would set up a DataGrid/GridView with the default setting.
Styling
The above example shows the data in a plain vanilla style, certainly we do not want show the data in this way rather we would like to add some styling property. AJAX Grid similarly exposes CssClass, HeaderCssClass, RowCssClass, AlternatingRowCssClass and SelectedRowCssClass to do the same styling as the DataGid/GridView controls. Once we apply these styles the above example output looks like the following.
Figure 2: Output with Styles
The Supplier.aspx of the attached sample has full source code of the above two examples.
The Column Collection
When showing the tabular data we certainly like to add more control such as hiding a column, showing a different header text, alignment, allow sorting, setting column width etc. In AJAX Grid we can easily define the column collection in declarative model like the following:
Code Listing 3: AJAX Grid with Columns
view sourceprint?01.
03.SortOrderAscendingImage="Images/up.gif" SortOrderDescendingImage="Images/dn.gif">
04.
05.
Nowrap="True"/>
07.
08.
09.
10.
11.
Nowrap="True"/>
13.
14.
15.
16.
The AJAX Gird Column contains the following important properties:
HeaderText: Same as in the DataGrid/GridView.
DataField: Same as in the DataGrid/GridView.
Sortable: If true, the header text will be displayed as a hyperlink instead of text.
SortField: Must be specified if SortField is different from DataField.
FormatString: Same as in the DataGrid/GridView.
Sorting
The AJAX Grid also supports sorting in the same way as the DataGrid/GridView control. When a column header is clicked it raises the Sort event, which we have to subscribe. To show the current sort order we have to set the SortOrderAscendingImage and SortOrderDescendingImage property of AJAX Grid. In order to get the current sort column and order we can check the SortColumn and SortOrder property. The following shows how to add sorting support in the AJAX Grid which shows the Customers table of Northwind database.
Code Listing 4: AJAX Grid with Columns
view sourceprint?01.function pageLoad()
02.{
03.
// Getting the reference of the Client Components and
04.
// attaching the event handlers
05.
_grid = $find('grid');
06.
_grid.add_sort(sorted);
07.}
08.
09.function sorted(sender, e)
10.{
11.
// Set the SortColum and SortOrder of the Grid so
12.
// that it can properly render current sort column and
13.
// and the associated image
14.
15.
_grid.set_sortColumn(e.get_sortColumn());
16.
_grid.set_sortOrder(e.get_sortOrder());
17.
18.
// Here we can call the WebService with the new SortColumn and SortOrder
19.}
Figure 3: AJAX Grid Sorted
The Customer.aspx of the attached sample has the full source code of the sorting example.
Selecting/Deleting Rows
To show the Select and Delete link like in the DataGrid/GridView we have set the ShowSelectLink and ShowDeleteLink property to true. Once a row is selected it will raise the SelectedIndexChange event. The same thing happens when the delete link is clicked; it raises the RowDelete event. Both of these events pass the CommandName and CommandArgument but for this the DataKeyName must to be set. For example if we set the DataKeyName to the primary key of a table in these events it will have the primary key value as CommandArgument. You can also select a row by using the SelectedIndex property or the Select() method. To deselect a row use the ResetSelection() method.
The RowDataBound Event
In the RowDataBound event we can do some special processing before the data is bound. For example when showing the Products table of Northwind database we can change the background color to red that Unit in Stock is less than 10. Another example could be that our Web Service returns the Product's CategoryID but we want to show the category name instead of that CategoryID. These kinds of changes can be done in this event. This event passes the binding row and the current data item that it is binding. The following shows how to bind this event and do the special processing.
Code Listing 5: RowDataBound
view sourceprint?01.function pageLoad()
02.{
03.
// Getting the reference of the Client Components
04.
// and attaching the event handlers
05.
_grid = $find('grid');
06.
_grid.add_rowDataBound(rowDataBound);
07.}
08.
09.function rowDataBound(sender, e)
10.{
11.
var product = e.get_dataItem();
12.
13.
var tdCategory = e.get_tableRow().cells[2];
14.
var categoryName = getCategoryName(product.CategoryID);
15.
tdCategory.innerHTML = categoryName;
16.
17.
var tdUnitsInStock = e.get_tableRow().cells[5];
18.
if (product.UnitsInStock < 10)
19.
{
20.
tdUnitsInStock.style.backgroundColor = '#ff0000';
21.
}
22.}
Figure 4: RowDataBound
The Product.aspx of the attached sample has the full source code of the RowDataBound event example.
Paging
When working with large tables we often required to use paging. Although the DataGrid/GridView has built-in support for paging they are pretty much useless. Most developers often refuse to use the built-in functionality and use their own custom logic which usually takes a start index, page size and other additional parameters and in turn returns only the paged records with the total number of records. The sample DataService.asmx contains some of the methods (GetCustomerList, GetProductList) which contain the custom paging logic. Usually a Pager shows the page numbers, next/previous, first/last page links. The following shows how to implement a pager control.
Code Listing 6: AJAX Grid Pager JavaScript
view sourceprint?01.function pageLoad()
02.{
03.
// Getting the reference of the Client Components
04.
// and attaching the event handlers
05.
06.
_grid = $find('grid');
07.
_grid.add_sort(sorted);
08.
09.
_pager = $find('pager');
10.
_pager.add_pageChange(pageChanged);
11.
12.
//Getting the reference of the DOM elements
13.
_message = $get('message');
14.
15.
loadCustomers();
16.}
17.
18.function sorted(sender, e)
19.{
20.
// Set the SortColum and SortOrder of the Grid so that
21.
// it can properly render current sort column
22.
// and the associated image
23.
24.
_grid.set_sortColumn(e.get_sortColumn());
25.
_grid.set_sortOrder(e.get_sortOrder());
26.
27.
// need to reset the current page as sorting has been changed
28.
_pager.set_currentPage(1);
29.
30.
loadCustomers();
31.}
32.
33.function pageChanged(sender, e)
34.{
35.
// Set the new page as current page
36.
_pager.set_currentPage(e.get_newPage());
37.
loadCustomers();
38.}
39.
40.function loadCustomers()
41.{
42.
// Calculating the startindex
43.
var startIndex = ((_pager.get_currentPage()-1) * _pager.get_rowPerPage());
44.
45.
// Need to convert the sortoder which our WS can understand
46.
// This needs to be on one line. Its been wrapped to display better in this article.
47.
var sortOrder = (_grid.get_sortOrder() == Ajax.Controls.GridSortOrder.Descending)
48.
? 'DESC' : 'ASC';
49.
50.
_message.innerHTML = "
";
51.
_message.innerHTML += "";
52.
_message.innerHTML += "Loading Customers...
"; 51.
_message.innerHTML += "";
52.
_message.innerHTML += "Loading Customers...
53.
_message.style.display = "";
54.
55.
DataService.GetCustomerList
56.
(
57.
startIndex,
58.
_pager.get_rowPerPage(),
59.
_grid.get_sortColumn(),
60.
sortOrder,
61.
function(pagedResult)
62.
{
63.
var total = 0;
64.
var customers = null;
65.
66.
if (pagedResult != null)
67.
{
68.
total = pagedResult.Total;
69.
customers = pagedResult.Rows;
70.
}
71.
72.
_grid.set_dataSource(customers);
73.
_grid.dataBind();
74.
75.
_pager.set_rowCount(total);
76.
77.
_message.innerHTML = '';
78.
_message.style.display = 'none';
79.
},
80.
function(exception)
81.
{
82.
_message.innerHTML = '' + exception.get_message() + '';
83.
}
84.
);
85.}
Code Listing 7: AJAX Grid Pager ASPX
view sourceprint?01.
Figure 5: AJAX Grid Pager
The followings are some of the important properties of the AJAX Pager:
ShowInfo: When true, shows the info such as Page 1 of 10. The default value is false.
ShowFirstAndLast: When true, shows the first and last Link. The default value is true.
FirstText: The text which will be displayed as link for the first page. The Default value is <<
LastText: The text which will be displayed as link for the last page. The Default value is >>
ShowPreviousAndNext: When true, shows the Previous and Next Link. The default value is false.
ShowNumbers: When true, shows the page numbers as link. The default value is true.
RowPerPage: The Number of row that each page contains. The default value is 10.
CurrentPage: The currentpage that the pager is showing.
HideOnSinglePage: The control will not be rendered if it founds there is only one page.
ShowTip: When true, a tooltip will appears on hovering on any of the links.
InfoCssClass: Styling property for the info part.
CurrentPageCssClass: Styling property for the current page.
OtherPageCssClass: Styling property for other pages.
The AJAX Pager contains only one event PageChange that the developers have to subscribe to load the new page data. I have excluded the Pager from the Grid so that it can be utilize in with other controls that show tabular data.
Both the Customer.aspx and Product.aspx of the attached sample has full source code of the Paging example.
Drag and Drop
Drag and Drop is an essential part of any Rich Web Application and thus it has become a common feature for Web 2.0 applications. Certianly Pageflakes is one of the best candidates for utlizing drag and drop. The Ajax Grid has built-in support for column drag and drap. Just set the AllowDragAndDrop property for any Column to true and it will be drag and dropable. The following screenshot shows the implemented version of a drag and drop in the Customers table of the Northwind database:
Figure 5: AJAX Grid Drag and Drop
The Ajax Grid raises the ColumnDragStarted when the column drag started and ColumnDropped upon dropping the column. The following code shows how to track the column and drag and drop in these events.
Code Listing 8: AJAX Grid Drag and Drop
view sourceprint?01.function pageLoad()
02.{
03.
_grid = $find('grid');
04.
_grid.add_columnDragStart(columnDragStart);
05.
_grid.add_columnDropped(columnDropped);
06.}
07.
08.function columnDragStart(sender, e)
09.{
10.
alert(e.get_column().headerText); // the event passes the column reference
11.}
12.
13.function columnDropped(sender, e)
14.{
15.
// this event also passes the column reference with old and new index
16.
alert(e.get_column().headerText);
17.
alert(e.get_oldIndex());
18.
alert(e.get_newIndex());
19.}
We can also use the built-in ProfileService to persist the columns position, so that in the next visit the columns positioning is same as the user left it in the last visit.
Summary
Microsoft ASP.NET AJAX is great platform to develop web application but currently it is lacking of Client Side Components especially which works with data. Although you will find 30+ controls in ASP.NET Ajax ToolKit but most of them are mainly extender, which extends existing server side ASP.NET Controls. Certainly we can develop these kinds of controls to enrich it.
Sunday, December 5, 2010
Input Not Supported
I spent some time today preparing my old HP to network with my new P4. I removed the old DSL modem and an IDE controller card. I blew out the dust (not much surprisingly). I installed a NIC (D-link). I put the CDRW that had been on the IDE Controller as Slave (and jumpered it as Slave) on the same cable with the DVD. I closed it up and tried to boot.
It did POST, checked RAM and so on, then the WinME boot screen flashed and went to a blinking cursor. After a few seconds, the cursor gave way to a completely black background and a white box in the middle with the note above: "Input Not Supported". Windows continued to boot and apparently was fully booted into Windoze which I found when I got into Safe Mode and watched Scandisk run because I had shut down the power without doing Shutdown, since I couldn't see it.
I have no trouble booting into Safe Mode and I figured it had something to do with the monitor being different than the one I had been using so I went into Device Manager and eventually removed all monitor references (there were about 6 which I thought made it more likely this was the problem). It made no difference and still didn't do any better once I got the correct driver installed. By this time I was using Ctrl-Alt-Delete to reboot, so I didn't have to worry about corrupting the hard drive. I went back into Safe Mode and removed all but one Display Adapter, no joy. I went in again and removed the remaining one and Windoze put one back as I rebooted. Still no joy. I removed the NIC and still no joy.
At this point the computer is on and the "Input Not Supported" is dominating the screen.
The computer is an HP custom with 700Mhz AMD slot A. It has a 15 gig Maxtor hard drive, a DVD, CDRW, Nvidia video and a sound card (nothing fancy). At this point, there are no peripherals attached and the NIC is removed.
I would appreciate any ideas for how to proceed next....
Input not supported
reducing the refresh rate of the monitor in advanced settings of display properties? IS the refresh rate to high for the monitor your using?
right click desktop/properties/settings/advanced/monitor ( well you know this but for the other people)
I had left the HP on with the "Input Not Supported" screen while I was doing other things including reading my messages here. After Variable's suggestion I went over to see what I could do with it and found that my screen saver was running merrily away in very good resolution. I moved the mouse and went back to "Input Not Supported". GRRRRR....
I may end up having to reinstall Windoze, but I would really rather avoid that for the moment. After I get everything set up on this computer the way I want, I plan to do that anyway, but I want to transfer some things first. I also would really like to just figure out what the heck is going on.
What I have done now: I tried the advanced settings and they simply said that the information is unknown since it was in Safe Mode. I tried changing settings on the monitor itself and used Reset. It is lining up the picture better with the Autoconfig, but it isn't showing me Windoze in Normal Mode. I disabled almost everything in msconfig and no joy. Right now it is sitting in Safe Mode and I will experiment some more before bed, but I am not sure what else I can do. I am going to look at Device Manager again to see if I missed anything there.
I just went in and found out the highest resolution on my graphics card is 1024 x 768 and the acer monitor is set to 1440 x 900! There is a CD with the acer and I had that in the drive but with no video I couldn't ask my computer to go get it unless it was doing it automatically.
Will the CD give my computer 1440 x 900 resolution? Is it worth trying to get this monitor to work with my computer seeing as how I am not running Vista?
The problem is that your hertz rate is set to 75 and your acer monitor doesn't support that. Go into the dispaly settings and change the hertz rate to 60. Fixed my a couple of minutes ago
What this means is that there are indeed monitors just for Vista, this is so because it has to do with DRM and Copyright issues..
Vista has special software that "Talks to" software in these Monitors.
Also you need a suitable Video Card that will "Drive" the 19" Monitor. These MUST be installed, as should any "Monitor" Drivers too.
As said, there are "Drivers" for Monitors too, if a CD came with the monitor this must be installed also.
It may say The input not supported but that may simply be, that at the present Video Card settings for the "Size & Depth" are incorrect for the Monitor.
Try booting into "Safe Mode" F8, and set the Monitor for say 800x600x16 bit color. Reboot & if it come up with a picture, when at ya desktop ya can then adjust the screen resolution for your optimal size and color depth, by right clicking and selecting "Properties" from Menu.
All I can say is WOW! I have been using my pc with my monitor for months and I was installing a new printer and must have wiggled something loose, and all I was getting out of my monitor was "INPUT NOT SUPPORTED." So I came to this forum, and low and behold, if you DO NOT have another monitor to hook up to your PC, please do this in the sequence I have listed as this was my fix
1. Power down PC (you will have to do a cold/hard shut down by pressing the power button as you cannot see your desktop due to this message).
2. Unplug monitor from the power strip *and* from the back of the monitor itself, freeing the cord completely
3. Plug power cord into monitor *FIRST*
4. Plug power cord into the power strip
5. Turn on monitor power *FIRST*
6. Turn on power to PC
This *hopefully* will get you up and going. If not, then you will need to try to get another monitor to adjust the display settings (60 hz and 1440 x 900 @ 32 bit). You can get to this by (I have Vista):
1. Left click mouse anywhere on desktop
2. Go to properties
3. Go to display settings
Once you have completed this (again, hopefully with an extra monitor you have somewhere so you are able to see what you are doing) then do the entire sequence up above again by shutting down, unplugging power cord completely to monitor, then powering monitor on first before PC, this is a hugely important step. I really hope this helps someone. I have spent the past 3 hours wanting to yank my hair out!
1. check the power cords- make sure all are snug.
2. check and make sure no pins are bent in the cord to the computer
3. make sure that the monitor is not in auto-power save. Or in auto off mode. For example- is the light amber or green.
4. finally, make sure that your settings on your computer are not set to power off your monitor- as in a blank screen saver, power save or hibernate
It did POST, checked RAM and so on, then the WinME boot screen flashed and went to a blinking cursor. After a few seconds, the cursor gave way to a completely black background and a white box in the middle with the note above: "Input Not Supported". Windows continued to boot and apparently was fully booted into Windoze which I found when I got into Safe Mode and watched Scandisk run because I had shut down the power without doing Shutdown, since I couldn't see it.
I have no trouble booting into Safe Mode and I figured it had something to do with the monitor being different than the one I had been using so I went into Device Manager and eventually removed all monitor references (there were about 6 which I thought made it more likely this was the problem). It made no difference and still didn't do any better once I got the correct driver installed. By this time I was using Ctrl-Alt-Delete to reboot, so I didn't have to worry about corrupting the hard drive. I went back into Safe Mode and removed all but one Display Adapter, no joy. I went in again and removed the remaining one and Windoze put one back as I rebooted. Still no joy. I removed the NIC and still no joy.
At this point the computer is on and the "Input Not Supported" is dominating the screen.
The computer is an HP custom with 700Mhz AMD slot A. It has a 15 gig Maxtor hard drive, a DVD, CDRW, Nvidia video and a sound card (nothing fancy). At this point, there are no peripherals attached and the NIC is removed.
I would appreciate any ideas for how to proceed next....
Input not supported
reducing the refresh rate of the monitor in advanced settings of display properties? IS the refresh rate to high for the monitor your using?
right click desktop/properties/settings/advanced/monitor ( well you know this but for the other people)
I had left the HP on with the "Input Not Supported" screen while I was doing other things including reading my messages here. After Variable's suggestion I went over to see what I could do with it and found that my screen saver was running merrily away in very good resolution. I moved the mouse and went back to "Input Not Supported". GRRRRR....
I may end up having to reinstall Windoze, but I would really rather avoid that for the moment. After I get everything set up on this computer the way I want, I plan to do that anyway, but I want to transfer some things first. I also would really like to just figure out what the heck is going on.
What I have done now: I tried the advanced settings and they simply said that the information is unknown since it was in Safe Mode. I tried changing settings on the monitor itself and used Reset. It is lining up the picture better with the Autoconfig, but it isn't showing me Windoze in Normal Mode. I disabled almost everything in msconfig and no joy. Right now it is sitting in Safe Mode and I will experiment some more before bed, but I am not sure what else I can do. I am going to look at Device Manager again to see if I missed anything there.
I just went in and found out the highest resolution on my graphics card is 1024 x 768 and the acer monitor is set to 1440 x 900! There is a CD with the acer and I had that in the drive but with no video I couldn't ask my computer to go get it unless it was doing it automatically.
Will the CD give my computer 1440 x 900 resolution? Is it worth trying to get this monitor to work with my computer seeing as how I am not running Vista?
The problem is that your hertz rate is set to 75 and your acer monitor doesn't support that. Go into the dispaly settings and change the hertz rate to 60. Fixed my a couple of minutes ago
What this means is that there are indeed monitors just for Vista, this is so because it has to do with DRM and Copyright issues..
Vista has special software that "Talks to" software in these Monitors.
Also you need a suitable Video Card that will "Drive" the 19" Monitor. These MUST be installed, as should any "Monitor" Drivers too.
As said, there are "Drivers" for Monitors too, if a CD came with the monitor this must be installed also.
It may say The input not supported but that may simply be, that at the present Video Card settings for the "Size & Depth" are incorrect for the Monitor.
Try booting into "Safe Mode" F8, and set the Monitor for say 800x600x16 bit color. Reboot & if it come up with a picture, when at ya desktop ya can then adjust the screen resolution for your optimal size and color depth, by right clicking and selecting "Properties" from Menu.
All I can say is WOW! I have been using my pc with my monitor for months and I was installing a new printer and must have wiggled something loose, and all I was getting out of my monitor was "INPUT NOT SUPPORTED." So I came to this forum, and low and behold, if you DO NOT have another monitor to hook up to your PC, please do this in the sequence I have listed as this was my fix
1. Power down PC (you will have to do a cold/hard shut down by pressing the power button as you cannot see your desktop due to this message).
2. Unplug monitor from the power strip *and* from the back of the monitor itself, freeing the cord completely
3. Plug power cord into monitor *FIRST*
4. Plug power cord into the power strip
5. Turn on monitor power *FIRST*
6. Turn on power to PC
This *hopefully* will get you up and going. If not, then you will need to try to get another monitor to adjust the display settings (60 hz and 1440 x 900 @ 32 bit). You can get to this by (I have Vista):
1. Left click mouse anywhere on desktop
2. Go to properties
3. Go to display settings
Once you have completed this (again, hopefully with an extra monitor you have somewhere so you are able to see what you are doing) then do the entire sequence up above again by shutting down, unplugging power cord completely to monitor, then powering monitor on first before PC, this is a hugely important step. I really hope this helps someone. I have spent the past 3 hours wanting to yank my hair out!
1. check the power cords- make sure all are snug.
2. check and make sure no pins are bent in the cord to the computer
3. make sure that the monitor is not in auto-power save. Or in auto off mode. For example- is the light amber or green.
4. finally, make sure that your settings on your computer are not set to power off your monitor- as in a blank screen saver, power save or hibernate
Subscribe to:
Posts (Atom)