C# – Passing value in silverlight

csilverlight-2.0

How can pass a value from one page to another page in silverlight.
I have one silver light application which contains two pages, one xaml.cs file and one asmx.cs file. I have one text box in xaml page names Text1. My requirement is that at the time of running, i could pass the textbox value to asmx.cs file. How it will be done?
my code in asmx.cs file is

public string DataInsert(string emp)
    {
        SqlConnection conn = new SqlConnection("Data Source=Nisam\\OFFICESERVERS;Initial Catalog=Employee;Integrated Security=SSPI");
        SqlCommand cmd = new SqlCommand();
        conn.Open();
        cmd.Connection = conn;
        cmd.CommandText = "Insert into  demo Values (@Name)";
        cmd.Parameters.AddWithValue("@Name", xxx);
        cmd.ExecuteNonQuery();
        return "Saved";
    }

the value xxx in code is replaced by the passed value from xaml.cs page. pls help me

Best Answer

Your asmx file is a web service, you will have to invoke web service in your silverlight app to communicate with asmx. And you will need to create appropriate web method with parameters.