Saturday, December 18, 2010

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