Monthly Archives: December 2009

Redirecting the aspx file from Silverlight


Code for redirecting the ASPX file from Silverlight is as below

string url = “https://nkdeveloper.wordpress.com”;
HtmlPage.Window.Navigate(new Uri(url, UriKind.Absolute), “_blank”);

 

(or)

HtmlPage.Window.Navigate(new Uri(“https://nkdeveloper.wordpress.com “));

(or)

HtmlPage.Window.Eval(“window.open(“https://nkdeveloper.wordpress.com”, ‘_self)”);

 

🙂

How to redirect the XAML file in silverlight


Here is the code to redirect with in silverlight(XAML) file .

public static void Navigate(UserControl newPage)        {

            UserControl oldPage = root.Children[0] as UserControl;

            root.Children.Add(newPage);

            root.Children.Remove(oldPage);

        }

Add the above method in App.xaml file . Then modify the Application_Startup method as below code.

private void Application_Startup(object sender, StartupEventArgs e)        {

            root = new Grid();

            root.Children.Add(new MainPage());

            this.RootVisual =root;

        }

Then you can add the below code line in the page as want for example you can put it inside the button click event

App.Navigate(new MarketCenter());

🙂

Updates in Asp.Net Ajax


1) AJAX Control Toolkit — May 2009 Release


a. http://www.asp.net/ajax/AjaxControlToolkit/Samples/
b. http://www.codeplex.com/Wiki/View.aspx?ProjectName=AjaxControlToolkit
c. http://www.asp.net/learn/Ajax-Control-Toolkit/tutorial-47-cs.aspx

2) Microsoft AJAX Library 3.5
http://msdn.microsoft.com/en-us/asp.net/dd162267.aspx

3) ASP.NET AJAX Preview 4.0
http://www.codeplex.com/aspnet/Wiki/View.aspx?title=AJAX&referringTitle=Home

4) AJAX Videos
http://www.asp.net/learn/ajax-videos/#AJAX

5) AJAX Control Toolkit Videos
http://www.asp.net/learn/ajax-videos/#AjaxControlToolkit

6) AJAX Tutorials
http://www.asp.net/learn/ajax/#ajax

7) AJAX Control Toolkit Tutorials
http://www.asp.net/learn/ajax/#ajaxcontroltoolkit

8) ASP.NET 3.5 Documentation
http://msdn.microsoft.com/en-us/library/bb398874.aspx

9) ASP.NET AJAX 1.0 Documentation and Migration Guides
http://www.asp.net/ajax/documentation/

10) ASP.NET AJAX Forums

http://forums.asp.net/default.aspx?GroupID=34

Error handling in an AJAX


Error handling in an AJAX world can often be tricky — especially when AJAX call-backs are taking place and a mixture of client and server code is running within an application. In its most recent release, the control that comes with ASP.NET AJAX now has much more robust error handling and reporting features for you to use. Specifically:

1) You can now handle the “OnAsyncPostBackError” event on the control to catch and/or modify an error message that occurs during the processing of an AJAX postback callback on the server.
2) You can now set the “AllowCustomErrors” property on the control to enable the standard ASP.NET custom error support to be enabled to redirect a user automatically to an error page when an error occurs (even if it is happening during an AJAX postback).
3) You can now optionally handle client-side JavaScript events on the page to intercept any error message sent back from the server, and perform custom client-side actions as a result (for example: to output the error message to a nicely formatted <!–

–>section instead of performing a pop-up message).

INTRODUCTION TO ASP.NET AJAX SERVER EXTENDER CONTROL


In the VS2008 Microsoft include basic and frequently used AJAX server extender in its toolbox under AJAX Extensions tab. It contains both Server side and Client Side code to give Ajax like behaviors.

The server control they included are
1) Script Manager
2) Scrip Manager Proxy
3) Update Panel
4) Update Progress
5) Timer

SCRIPT MANAGER
Script manager must be included before any Ajax Server control or any AJAX client script are include (ie) Partial-page rendering, which enables regions on the page to be independently refreshed without a post back. It manages AJAX Extensions script libraries and script files, partial-page rendering, and client proxy class generation for Web and application services.

SCRIPT MANAGER PROXY
In some situation you have to use more than one Script manager, but per page you can use only one Script Manager at that time you can use Script Manage Proxy.

UPDATE PANEL
By using Asp.Net update panel we can update only that particular region instead of refreshing the entire page. This is referred to as performing a partial-page update.

UPDATE PROGRESS
The UpdateProgress control enables you to provide feedback about the progress of partial-page rendering.

TIMER
The Timer control is to postbacks the page at defined intervals. If we use the Timer control with an UpdatePanel control, we can enable partial-page updates at a defined interval.

Keep Enjoy!

Basic of AJAX


Introduction to AJAX

AJAX – Asynchronous JavaScript and XML, is used in webdevelopment to enrich the web application. Before ajax the web page has to interact with the server and load the entire page newly each time when the page get loaded. But AJAX interact with the server and load the data in the particular region of the page using javascript. So the page is not get refreshed each time, so user can feel just like the windows application.

Ajax has internet standareds

1) JavaScript

2) XML

3) HTNL

4) CSS

 XMLHttpRequest object

 XMLHttpRequest is an important part of the AJAX web development technique, and it is used by many websites to implement responsive and dynamic web applications. Ajax uses XMLHttpRequest object to interact with the server by sending request to server and receiving response from the server and update the region, this request and response is take place at the background

ASP.NETAJAX 3.5

In the VS2008 now the AJAX is get included with the .NET Framework3.5, so there is no need to download the separately for ajax. Apart from the Ajax basics control there are several AJAX server extender control is also available you can make use of it for easy programming. To download the Ajax Control Toolkit click here

How to Download Ajax control Toolkit for framework3.5

1) After download the zip file from the above link. Just extract the zip file In a separate folder .

2) Create a separate tab in Toolbox for AJAX Toolkid

3) Right click inside the Tab control choose the browse button then select the path where you extract the Toolkit. Inside that Select SampleWebsite => bi n=> insid that select the AjaxControlToolkit.dll. click ok Now the Extender control is ready for use.

 Keep Enjoy !