Passing value in silverlight

Posted by Dilse Naaz on Stack Overflow See other posts from Stack Overflow or by Dilse Naaz
Published on 2009-08-21T09:46:30Z Indexed on 2010/04/03 10:03 UTC
Read the original article Hit count: 307

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about silverlight-2.0

Related posts about c#