SharePoint, XBOX, .NET, Technology - What I am reading

    [Home] [Recent] [Site Map] [SharePoint] [XBOX] [Biztalk]

AJAX

   

2:59 Problem after deploying ASP.NET AJAX RC1 app ? >> ASP.NET Blogs

You've deployed your app in prod server, you run it on the browser and you get an exception:

Object reference not set to an instance of an object.


Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.


Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.] System.Web.Script.Services.WebServiceData.GetWebServiceData(Http
Context context, String virtualPath, Boolean failIfNoData,
Boolean pageMethods) +378 System.Web.Script.Services.PageClientProxyGenerator.GetClientProxy
Script(HttpContext context, IPage page, Boolean debug) +45 System.Web.UI.ScriptManager.RegisterServices() +728 System.Web.
UI.ScriptManager.OnPagePreRenderComplete(Object sender,
EventArgs e) +244 System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +2012740 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBef
oreAsyncPoint, Boolean includeStagesAfterAsyncPoint)+1566

It happens when your site use ASP.NET AJAX RC in a VS 2005 Web Site Project and you deploy with "publish web site" or "web deployment project" utility with checkbox "allow the site to be updatable" unchecked.

It's a bug from ASP.NET AJAX RC1 and will be fixed in next version.

Until this you can make everything work fine if you precompile with checkbox "allow this site to be updatable" checked.

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

20:03 Call Page WebMethod from a Winforms Client using AJAX >> ASP.NET Blogs

My primary idea for this post was how to use the small and beauty JSON format for data transfer in a windows mobile application. For that I use the infrastructure of AJAX. I implement a Webmethod in a classic ASPX page.

<script runat="server">

<WebMethod()> _

<ScriptMethod()> _

Public Shared Function Nachladen1(ByVal contextKey As String) As String

Return "Hannes Preishuber"

End Function

</script>

For calling the Method form the page (or from a webservice) i use a Winforms application and the httpwebrequest class. Then i call the URL following the method name. The second part is to use a specific content  type in header "application/json". To transfer complex data you have to build a json type. For my sample i used a simple string containing "test". The contextKey is a reserved word.

The result is in my sample also a string and can be passed to a textbox.

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim wRequest As HttpWebRequest = HttpWebRequest.Create("http://url/Default4.aspx/Nachladen1")

wRequest.Method = "POST"

wRequest.ContentType = "application/json; charset=utf-8"

wRequest.Headers.Add(HttpRequestHeader.Pragma.ToString, "no-cache")

Using writer As Stream = wRequest.GetRequestStream

Dim send As String

send = "{""contextKey"":""test""}"

Dim data As [Byte]() = Encoding.ASCII.GetBytes(send)

writer.Write(data, 0, data.Length)

End Using

Dim WResponse As HttpWebResponse = CType(wRequest.GetResponse, HttpWebResponse)

Dim recieve As StreamReader = New StreamReader(WResponse.GetResponseStream())

Dim result As String = recieve.ReadToEnd.ToString

TextBox1.Text = result

End Sub

 

Small nice and sexy!

AJAX

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

7:35 Refresh UpdatePanel via JavaScript >> ASP.NET Blogs

I have seen this asked a couple of times in the newsgroups hence this post. A simple way of refreshing an UpdatePanel using JavaScript is to add a HiddenField to the page, change its value using JS and then have the HiddenField raise a postback event.

The HiddenField causes the UpdatePanel to refresh because it has been declared as a trigger, is a child trigger or because the UpdatePanel.Update() method is called in the HiddenField ValueChanged event handler. The sample code shows these three scenarios.

Note: The HiddenField will obviously need to be registered as an async postback control (RegisterAsyncPostBackControl) if it is outside the UpdatePanel.

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

21:32 Single Code Base : Deploy on the Web and in Windows... >> ASP.NET Blogs

 

As you can tell I really love this VisualWebGui stuff from Guy Peled.  Take a look at the latest ability, its called "Dual Mode". Essentially you build your web site using their technology and you deploy to the Web normally, or deploy as a complete Windows Forms application!  Of course you will have to make special consideration for your business objects and more importantly your data source but its just damn cool.

I know I have been waiting for something like this for many, many years now. 

 

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

22:51 ASP.NET AJAX - Ajax Server Extensions sample >> ASP.NET Blogs

In ASP.NET AJAX, the Ajax Server Extensions consists of a powerful set of server controls that simulate Ajax behavior on the client. In other words, these controls do not perform Ajax in its traditional sense (JavaScript calls to a server and dynamic updates with dhtml) but rather in a different way that gives the same illusion to the end user.

To demonstrate the power of these controls, I've taken an existing ASP.NET application that suffered from normal, pre-ajax symptoms like page refreshes, static content and loss of interactivity and added the controls to make it a more engaging experience. The goals for the task were as follows:

Along the way I also tried to exercise some common, recommended patterns for ASP.NET AJAX:

The application manages to use all of the controls in the AJAX Extensions (not the Futures CTP). For a little extra, it includes the AutoCompleteExtender for the search box. By the way, this control is now in the Ajax Control Toolkit - where it belongs.

The code for the application (written for the 1.0 release) can be downloaded here:  http://www.neudesic.com/uploads/david_barkol/ajaxserverextensions.zip  

Below is a snapshot of the application in action:

Ajax Server Extensions

 

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

18:26 AJAX Version 1.0 is Released! >> ASP.NET Blogs

I just noticed that AJAX 1.0 has been officially released. Be sure to check out the website for more details: http://ajax.asp.net/.

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

18:05 ASP.NET AJAX 1.0 is Released! >> ASP.NET Blogs

Its out.  http://ajax.asp.net/

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

8:07 ASP.NET AJAX Enabled Web Site File Manager >> ASP.NET Blogs

Now that Microsoft has released Atlas...sorry ASP.NET AJAX, lots and lots of applications are going to use it (many are already using it). Here is a simple but handy tool that I wrote using ASP.NET AJAX and the Control Toolkit.

BinaryIntellect Web Site File Manager is a FREE tool for managing files and folders of your web site. Just include the FileManager.aspx in your web site and that's it! You have a complete file manager ready. It supports almost all the file and folder management operations such as folder creation, cut, copy, paste, rename, delete and upload. You also get complete source code of the tool. Developed using ASP.NET 2.0 server controls, ASP.NET AJAX and ASP.NET AJAX Control Toolkit this tool is a must for any web site owner or host.

Download the tool at http://www.binaryintellect.net/products/displayproductdetails.aspx?productid=8

 

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

6:27 Inserting and deleting with the AJAX UpdatePanelPopupExtender >> ASP.NET Blogs

The UpdatePanelPopup Extender has been updated to use the ASP.net Ajax RTM version. I have also added an example that shows how to add/delete a record using the popup. Like before, we have a GridView and DetailsView setup using the standard Master/Details way. The only difference being that the DetailsView is "floating" and positioned at a location (top left icon) defined by the user using the custom extender. 

UpdatePanelPopupExtender4

Download the latest version here.

 

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

19:21 selectSingleNode and FireFox >> ASP.NET Blogs

Ajax is cool, for sure.  However sometimes its not so easy to work with, Ajax brings back a problem to web development that had been going by the wayside for a few years.  You see when I started back in early 2000, we had MS IE, Netscape 4, AOL and a slew of other browsers to support.  Writing interactive web programs for that collection of browsers was roughly akin to writing source code for multiple platforms.  Actually that's just what it is, i guess the analogy works too well.  ASP.NET made a lot of this much nicer, ok well in truth I worked on intranet based projects that locked into one browser.  So while the problem may not have gotten any better I couldn't see it ;)   All that changed a couple years ago, working on very public sites again they had to work in FF and IE, granted this is much better than the old browser collection.  So one problem i had yesterday was Firefox kept barking (rudely) about selectSingleNode() is not a function.  It sure is, its part of an xml element!  i said, but it persisted.  After much googling, i was able to write this function to wrap the functionality.  I'm sure there are better ways of doing this, but this is the one I found.  Judging by the amount of googling that i did to find the bits & parts, there are some out there with a similar problem.  I guess what i don't understand is why it takes three lines of code to do this in FF and only one in IE.  Is it that coming from an IE background my point of view is skewed?  Or is this just legitimately more difficult in FF?   I'll bet that most frameworks (atlas/etc..) have this built in and I just didn't see it.  Post a comment and tell me if that's it!

    function SelectSingleNode(xmlDoc, elementPath)
    {
        if(window.ActiveXObject)
        {
            return xmlDoc.selectSingleNode(elementPath);
        }
        else
        {
           var xpe = new XPathEvaluator();
           var nsResolver = xpe.createNSResolver( xmlDoc.ownerDocument == null ? xmlDoc.documentElement : xmlDoc.ownerDocument.documentElement);
           var results = xpe.evaluate(elementPath,xmlDoc,nsResolver,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
           return results.singleNodeValue; 
        }
    }
 
Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

1 2 3 4 5 6 7 8 9 10 下一页

   


^==Back Home


Month Archives:
Oct 2007
Sep 2007

Top Tags:
social software social networking .NET mashable Sharepoint ASP.NET Web 2.0 Web2.0 Startups Community News Search Marketplace General Software Development AJAX Windows Vista Visual Studio Microsoft myspace Silverlight People Powered! YouTube Vista MOSS Featured News C# Events MOSS 2007 Google WPF Office 2007 Web Community Security General Personal Xbox 360 facebook Tools development SharePoint 2007 Fun Atlas Architecture ASP.NET AJAX myspace codes TheLongTail IIS SQL Server Developers Revenue Sharing Video Pictures WCF Mobile 2.0 Announcements Orcas MIX07 Arcade Team System JavaScript News


@2007 All rights Reserved