Madmike's Blog

September 26, 2009

How should you make a Currency Convertor?

Filed under: Asp.net,C#,Java,Programming,Webservice — Florescu Radu @ 13:11
Tags: , , ,

A smart guy made a very good web service that gives you all the values you need from the BNR (National Bank of Romania) , you can use it like I did.
Include e web service reference in your Visual Studio project , then you use a code like this to get all the info you need ,for your project.`
Link to your web service here
The code to get the currency is down here:
Curs c = new Curs();
double d=c.getlatestvalue(“eur”);
Console.WriteLine(d);

Have fun using it

September 6, 2009

How to integrate Dojo with ASP.net

Filed under: Asp.net,C#,Dojo,Programming — Florescu Radu @ 19:36
Tags: , , , ,

First steps

Start your visual studio 2008 (Start->Programs->Microsoft Visual Studio 2008->Microsoft Visual Studio 2008).And select Web Development Settings.Then click on Start visual Studio

Start a new Project (ASP.net Website)

<%@ Page AutoEventWireup=”true”  CodeFile=”Default.aspx.cs” Inherits=”_Default” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;

<html xmlns=”http://www.w3.org/1999/xhtml”&gt;

<head runat=”server”>

<title>ASP.net and Dojo first example</title>

</head>

<body>

<form id=”form1″ runat=”server”>

<div>

</div>

</form>

</body>

</html>

Now lets include the code that will allow us to use the dojo scripts.This code ussually goes in the head part.

<script src=”Dojo/dojo/dojo.js”                       djConfig=”parseOnLoad:true”></script>

<script>

dojo.require(“dojo.parser”);

</script>

Now we have everything ready to unleash the power of Dojo

This is the first example of Dojo

<%@ Page AutoEventWireup=”true”  CodeFile=”Default.aspx.cs” Inherits=”_Default” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;

<html xmlns=”http://www.w3.org/1999/xhtml”&gt;

<head runat=”server”>

<title>ASP.net and Dojo first example</title>

<script type=”text/javascript” src=”Dojo/dojo/dojo.js” djConfig=”parseOnLoad:true”></script>

<script type=”text/javascript”>

//include the necessary files to use dojo parser and the button we use in the //body

dojo.require(“dojo.parser”);

dojo.require(“dijit.form.Button”);

</script>

//include some themes from dojo by default

<style type=”text/css”>

@import “Dojo/dijit/themes/tundra/tundra.css”;

@import “Dojo/dojo/resources/dojo.css”;

</style>

</head>

<body>

// we make a form with name myForm and an input button to type something in //it

<form id=”myForm” runat=”server”  method=”get” action=”Default.aspx”>

Please enter your name:

<input type=”text”/>

<div>

//this is a dijit.form.button

//sure you observer one new attributes here like : dojoType and the name of //the control : button

<button dojoType=”dijit.form.Button”>

Hello World!

<script type=”dojo/method” event=”onClick”>

alert(“bla”);

</script>

</button>

</div>

</form>

</body>

</html>

This is the output

Dojo tutorials

Many of them are good ,but I used this ones and there were very good:

http://www.roseindia.net/dojo/

http://www.dojotoolkit.org/forum/dojo-foundation/general-discussion/step-step-dojo-tutorials

And some books like this ones: dojo-using-the-dojo-javascript-library-to-build-ajax-applications-developers-library and practical-dojo-projects-practical-projects.

Your can also learn by doing with dojo book version 1.3

Links and references

You can also use this tutorial to see the things from other perspective :

http://www.codeproject.com/KB/ajax/Dojo-AjaxDotNet.aspx

Blog at WordPress.com.