Sunday, December 19, 2010

ASP.NET 4.0 Script Manager Enhancement Part-2 AjaxFrameworkMode Property

This will be a second part of ASP.NET 4.0 Script Manager enhancement. In this post I am going to explain about AjaxFrameworkMode Property. In Earlier asp.net version of script manager it will load entire Microsoft Ajax library whether its required or not. In asp.net 4.0 script manager we are having AjaxFrameMode property where we can set mode as explicit and we add only js that are required or not.

There are three values of AjaxFrameworkMode properties supported in asp.net

  1. Enabled- Specified that ASP.NET 4.0 scriptmanager will automatically load MicrosoftAjax.js file which is core element of Microsoft Ajax library.
  2. Disabled- This Specified that Microsoft Ajax Script features are disabled and script manager will not have any reference to any javascript files.
  3. Explicit- Specifies that you will explicitly include script references to individual framework core script file that your page requires, and that you will include references to the dependencies that each script file requires.

So here is example if require only Microsoftcore.js then we can use this explicitly without loading other unnecessary files.

<asp:ScriptManager ID="myScirptManager" AjaxFrameworkMode="Explicit" runat="server">

<Scripts>
<asp:ScriptReference Name="MicrosoftAjaxCore.js" />

</Scripts>
</asp:ScriptManager>


Hope this will help you increase your performance. Stay tuned for more..

Shout it
Share:

ASP.NET 4.0- ScriptManager Enhancement Part-I- Enable CDN Property.

ASP.NET 4.0 has been a great step forward to the programming. Microsoft has done incredible job with the performance. One of them is Enable CDN Property in asp.net 4.0 Script Manager. Let's explore it in details. As you all know that Microsoft is Providing Content Delivery Network for all the Ajax script that is used by Microsoft Ajax and All version of Jquery and JQuery UI. This Script manager enable cdn property will fetch all the script from that CDN Automatically. Developer don't have to worry about. As you know new generation browsers are like IE8 and Firefox are creating a new thread of each JS or CSS include in Webpage if they are coming from the CDN(Content Delivery Network). So this will be a great measure step towards it. Let's take an example to explore the things. I am taking one simple example which will demonstrate use of this. I am tasking a Textbox and Button. On the button click event it will update textbox's text property. I am going to use update panel to use Microsoft Ajax. For that first I need a script manager so I have taken script manager and and I have set its property EnalbleCdn=true. So without posting back whole it post back only that portion which are required. I have putted textbox in content template of update panel and I have created asynchronous post back trigger for button click event. So it will update the textbox text without creating post back. Let's how I have created. Following are Simple HTML for that.
<body>
<form id="form1" runat="server">
<div>

<asp:ScriptManager ID="cdnScriptManager" EnableCdn="true" runat="server">
</asp:ScriptManager>  

<asp:UpdatePanel ID="cdnUpdatePanel" runat="server">
<ContentTemplate>
<asp:TextBox ID="txtHelloWorld" runat="server"></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnHelloWorld" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<BR />
<asp:Button ID="btnHelloWorld" runat="server" onclick="btnHelloWorld_Click"  Text="Hello World!!"/>


</div>
</form>
</body>

Now I am going to create a click event which will change textbox text’. Following is a code for that.

protected void btnHelloWorld_Click(object sender, EventArgs e)
{
txtHelloWorld.Text = "Hello World";
}

That’s it Let’s run that with Ctrl+ F5 and It will look in firefox browser like following.


ScriptManager4.0, ASP.NET 4.0 Enhacement


Now Let’s see its view source and see how it’s look like. Following is a screenshot of view source.


ViewSource

As you can see its fetching all the JS from Microsoft Ajax Content delivery network. Isn’t that great. You just to have enable CDN Property =true and It will do rest of Job. That’s power of asp.net 4.0. Hope you liked it. Stay tuned for more in Part 2.
Shout it
Share:
Saturday, December 18, 2010

DotNetQuiz 2011 on BeyondRelational.com- Want to be quiz master or participant?

Test your knowledge with 31 Reputed persons (MVPS and bloggers) will ask question on each day of January and you need to give reply on that. You can win cool stuff.My friend Jacob Sebastian organizing this event on his site Beyondrelational.com to sharpen your dot net related knowledge. This Dot NET Quiz is a platform to verify your understanding of Microsoft .NET Technologies and enhance your skills around it. This is a general quiz which covers most of the .NET technology areas.

Want to be Quiz Master?

Also if you are well known blogger or Microsoft MVP then you can be Quiz master on the dotnetquiz 2011. Following are requirements to be quiz master on beyondrelational.com. I am also a quiz master on beyondrelational.com and

Quiz master eligibility:

You will be eligible to nominate yourself to become a quiz master if one of the following condition satisfies:

  • You are a Microsoft MVP
  • You are a Former Microsoft MVP
  • You are a recognized blogger
  • You are a recognized web master running one or more technology websites
  • You are an active participant of one or more technical forums
  • You are a consultant with considerable exposure to your technology area
  • You believe that you can be a good Quiz Master and got a passion for that

 

Selection Process:

Once you submit your nomination, the Quiz team will evaluate the details and will inform you the status of your submission. This usually takes a few weeks.

Quiz Master's Responsibilities:

Once you become a Quiz Master for a specific quiz, you are requested to take the following responsibilities.

  • Moderate the discussion thread after your question is published
  • Answer any clarification about your question that people ask in the forum
  • Review the answers and help us to award grades to the participants

For more information Please visit following page on beyondrelational.com

http://beyondrelational.com/quiz/nominations/0/new.aspx

Hope you liked it. Stay tuned!!!

Shout it
Share:

Microsoft silverlight 5.0 features for developers

Recently on Silverlight 5.0 firestarter event ScottGu has announced road map for Silverlight 5.0. There will be lots of features that will be there in silverlight 5.0 but here are few glimpses of Silverlight 5.0 Features.

Improved Data binding support and Better support for MVVM:

One of the greatest strength of Silverlight is its data binding. Microsoft is going to enhanced data binding by providing more ability to debug it. Developer will able to debug the binding expression and other stuff in Siverlight 5.0. Its also going to provide Ancestor Relative source binding which will allow property to bind with container control. MVVM pattern support will also be enhanced.

Performance and Speed Enhancement:

Now silverlight 5.0 will have support for 64bit browser support. So now you can use that silverlight application on 64 bit platform also. There is no need to take extra care for it.It will also have faster startup time and greater support for hardware acceleration. It will also provide end to end support for hard acceleration features of IE 9.

More support for Out Of Browser Application:

With Siverlight 4.0 Microsoft has announced new features called out of browser application and it has amazed lots of developer because now possibilities are unlimited with it. Now in silverlight 5.0 Out Of Browser application will have ability to Create Manage child windows just like windows forms or WPF Application. So you can fill power of desktop application with your out of browser application.

Testing Support with Visual Studio 2010:

Microsoft is going to add automated UI Testing support with Visual Studio 2010 with silverlight 5.0. So now we can test UI of Silverlight much faster.

Better Support for RIA Services:

RIA Services allows us to create N-tier application with silverlight via creating proxy classes on client and server both side. Now it will more features like complex type support, Custom type support for MVVM(Model View View Model) pattern.

WCF Enhancements:

There are lots of enhancement with WCF but key enhancement will WSTrust support.

Text and Printing Support:

Silverlight 5.0 will support vector base graphics. It will also support multicolumn text flow and linked text containers. It will full open type support,Postscript vector enhancement.

Improved Power Enhancement:

This will prevent screensaver from activating while you are watching videos on silverlight. Silverlight 5.0 is going add that smartness so it can determine while you are going to watch video and while you are not going watch videos.

Better support for graphics:

Silverlight 5.0 will provide in-depth support for 3D API. Now 3D rendering support is more enhancement in silverlight and 3D graphics can be rendered easily.

You can find more details on following links and also don’t forgot to view silverlight firestarter keynot video of scottgu.

http://www.silverlight.net/news/events/firestarter-labs/

http://blogs.msdn.com/b/katriend/archive/2010/12/06/silverlight-5-features-firestarter-keynote-and-sessions-resources.aspx

http://weblogs.asp.net/scottgu/archive/2010/12/02/announcing-silverlight-5.aspx

http://www.silverlight.net/news/events/firestarter/

http://www.microsoft.com/silverlight/future/

Hope this will help you. Stay tuned!!!.

Shout it
kick it on DotNetKicks.com
Share:

New blogger template for My blog - DotNetJaps

I have changed my blogger template to newer version of blogger. Hope you guys liked it. There are some difficulties over there but I still love the changes that blogger has offered. I know my old version of syntax highlighter is not working. But I am fixing that for all the older posts and already did it for some posts.

‘Change is in all things sweet.’

As a philosopher Aristotle has said we all should be ready to change. I have changed my blogger template due to following reasons.

  1. It’s more SEO Friendly. It is having less errors on w3c validations and It will increase search engine optimization for my blog. Still blogger template are not totally compliant like word press but blogger has decided to moved in that way so I am going to support that way.
  2. It has good way to monetize your blog.
  3. It has provided a new feature called ‘Pages’. You can create your own pages like I have created like asp.net interview questions etc. I will going to post some frequently asked interview questions over here.
  4. It has providing status same like Wordpress so its good be changed.

Above all, I have also changed my script high lighter version 3.0.83. So there might be some difficulties in older posts but I am going to fix one by one. If you found anything then please fill free to contact me via posting comment on my blog and I am going to fix that right away.

Here is screenshot my blog is look like.

MyBlog new blogger template

Please fill free to contact me if you have any question. I am going to start posting technical post soon. I need your support and I know you guys are going to provide me that.

Thanks once again all the readers who have made my blog successful.Keep reading it I will going to post more and more.

Technorati Tags: ,
Shout it
Share:
Friday, December 3, 2010

ASP.NET MVC Razor IsPost property with IF –Else loop

ASP.NET MVC Razor a new view engine from Microsoft looks very promising. Here are example of code where we can determine page is post back or not. It support a IsPost Property which will tell you whether page is post back or not. So based on that we can write code for handling post back. Also one of greatest feature of razor is we can write code for decision making like if else and other stuff with single @ statement isn’t that great stuff.

Here is the stuff how we can write the code with IsPost property.

@{
var Message="";
if(IsPost)
{
Message ="This is from the postback";
}
else
{
Message="This is without postback";
}
}
And we can now print that variable with following HTML Form.
<form method="POST" action="" >
<input type="Submit" name="Submit" value="Submit"/>
<p>@Message</p>
</form>

Here submit button will submit the form and based on that it will print message. Let’s see how it looks in browser before post back and after post back.

WithoutPostback

And After post back

AfterPostaback

So that’s it. Now you can do lots of stuff with IsPost property possibilities are unlimited!!. Hope this will help you..Happy Programming.

Technorati Tags: ,,
Shout it
kick it on DotNetKicks.com
Share:

Output caching with ASP.NET MVC Razor

Caching data greatly increase the website performance as its not going to do server round trip. I have already mentioned how you can use Output caching in web forms in earlier blog post here. Let’s see how we can do same thing with asp.net mvc. For this example I have used asp.net mvc razor. In asp.net mvc you can use OutputCache attribute to cache the output. Just like below.

[OutputCache(VaryByParam="none",Duration=60)]
public ActionResult Index()
{
ViewModel.Message = DateTime.Now.ToString();
return View();
}
Here it will cache the view for 60 second and will not go for server round trip. Let’s see How it will look into the browser.

Temp

You can also set the output caching in web.config and and create output cache profile which you can use any where like following.
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<clear/>
<add
name="MyOuputCacheProfile"
duration="60"
varyByParam="none" />
</outputCacheProfiles>
</outputCacheSettings>
</caching>
Here how you can use that profile.

[OutputCache(CacheProfile = "MyOuputCacheProfile")]
public ActionResult Index()
{
ViewModel.Message = DateTime.Now.ToString();
return View();
}
It support four type of settings for output caching. VaryByContentEncoding, VaryByParam, VaryByCustom,VaryByHeader. Hope this will help you!! happy Programming.

Technorati Tags: ,,
Shout it
kick it on DotNetKicks.com
Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews