Bhaskar  Sharma

Bhaskar Sharma

  • NA
  • 2
  • 2.6k

how to send data to a particular web method in windows phone

Feb 14 2014 2:06 PM
I am building my first application for windows phone 7 where i have a form with the following text fields and 1 radio button. The name of the textfields in the form is:   name, age, sadd, cadd, eadd, phn, zip. The xaml code for the radio button is:
 
<TextBlock Canvas.Left="20" Canvas.Top="157" Height="44" Name="gen" Text="Gender" Width="134" /> 
<RadioButton Canvas.Left="139" Canvas.Top="157" FontStyle="Italic" GroupName="Gender" Foreground="Black" Content="Male" Height="71" Name="male" Width="154" />
<RadioButton Canvas.Left="139" Canvas.Top="207" FontStyle="Italic" GroupName="Gender" Foreground="Black" Content="Female" Height="71" Name="fem" Width="140" />
 
 Now i want to send these data on clicking the submit button to a webmethod "registertoteam" in the following webservice:
http://ws.clearwintech.com/aap.asmx
 
The method contains the following fields: name, street_address, city_address, zip_code, phone_no, email_address, age, gender.
 
I know how to call a web service. Previously i have done on showing data from web service in my application. Now i want to send the values from the form to the web method:
 
 I have written the following code so far:
 
 
    private void submit_Click(object sender, RoutedEventArgs e) 
{
      if (name.Text == String.Empty)
   {
      MessageBox.Show("Please Enter the name");
      name
.Focus();
   }
     else
   {
      var svc = new KejriwalService.aapSoapClient();
svc
.registerToTeamAsync(name.Text, sadd.Text, cadd.Text, zip.Text, eadd.Text, phn.Text, age.Text);
   }
}
 The else part is not working. Please someone help me by editing my code in the else part so that the data gets submitted on clicking the submit button
 
 

Answers (1)