1
Answer

problem passing variable in web method

Ask a question
dim

dim

15y
2.6k
1

Hello everyone!

i am trying to pass string str to method getNetworkOffers. when checking radio2

i wait to be returned 1. However 0 is returned.

can you see any mistakes? i suppose that str is not passed. Can you help?

 

 thanks

 

private void pricesButton_Click(object sender, EventArgs e)
        {
            String str = "";

                localhost.Service wsConvert = new localhost.Service();
             
                string chooseService = System.Convert.ToString(serviceTextBox.Text);

                if (net2.Checked)
                {
                    str = "red";


                    resultLabel1.Text = "Price for downloading " + chooseService + "=" + wsConvert.getNetworkOffers(str, chooseService).ToString();
                    resultLabel2.Text = "Price for uploading " + chooseService + "=" + wsConvert.getNetworkOffers(str, chooseService).ToString();
                }
       
        }

 

 

 This is the webMethod  

 [System.Web.Services.WebMethod()]
    public double getNetworkOffers(string network, string service)
    {

        if ( network.Equals("red"))
        
        {
            //if (service.Equals("voice"))


            return 1;
        }
        else
        {
            return 0;
        }
      

        }
   

 


Answers (1)