Tuesday, January 18, 2011

ASP.NET MVC 2 Strongly Typed Html Helpers

using Strongly Typed Html Helpers will map the model to the view and it will help to have compile time checking of the views.

in views instead of using
<%=Html.TextBox("username", Model.UserName)%>

you can use

<%= Html.TextBoxFor( m => m.UserName)%>

in controller:

public ActionResult LogOn(string userName, string password)

use

public ActionResult LogOn(LoginViewModel loginviewModel)

moreover you dont need to use ValueProvider["UserName"].AttemptedValue to access Html value and you can use model directly.

and for adding attribute
<%= Html.TextBoxFor(model => model.UserName , new { @calss="SingleTextBox" }) %>

Thursday, January 13, 2011

Visual Studio Web Test - Toolbar add-ons is not loaded

I was trying to record some web test via Internet explorer 8 and the problem was that the plugin is not loaded. the problem was that "Microsoft Web Test Recorder Helper" was disable.

so to fix this , go to TOOLS -> Manage Add-ons and Enable the "Microsoft Web Test Recorder Helper" and try to restart IE.



for more infomation you can visit
Diagnosing and fixing Web Test recorder bar issues.

Wednesday, January 5, 2011

How to embed bing map into your website

this is the html code to embed Losvegas map:

<html>
<body>
<div id='earthMap' style="position:relative; width:400px; height:400px;">
</div>
<script charset="UTF-8" type="text/javascript" 
    src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&mkt=en-us">
</script>
<script type="text/javascript">
    var map = null;
    var mapID = '';
    // map from losvegas
    map = new VEMap('earthMap');
    map.LoadMap(new VELatLong(36.17, -115.14), 10 ,'i' ,true);
     
</script>

</body>
</html>



How to set custom thumbnail for facebook link of your page

sometime facebook can not fetch your image in your page. to add image to your link you can use :

<link rel="image_src" href="http://media.clickonf5.org/image/logo.png" />

facebook will cache the facebook pages, if you want to refresh the cache you can add some parameter to your page like mypage.html?t=! or using URL Linter

URL Linter
http://developers.facebook.com/tools/lint/

read more +,+