locked
How to Pass a CountryIdHiddenField value to a Function RRS feed

  • Question

  • User2092378267 posted

    I have a CountryIdHiddenField and I want to pass the CountryIdHiddenField.Value to the below Function.

    public string GetCountriesPdf(Entities.Masters.Country country)
    {
    string FilePath = ConfigurationManager.AppSettings["GetCountriesPdf"];
    
    switch(country.Id)
    {
    case 1:
    return FilePath+= "Country file";
    }
    }


    I have tried to pass like:
    protected void btn_Click (object sender, EventArgs e)

    {

    string Val = CountryIdHiddenField.Value;

    Country_Bal country = new Country_Bal();

    country.GetCountriesPdf(Val); //throwing an error here, that cannot pass this string to Entities.Masters.Country

    }

    Saturday, August 29, 2020 4:21 AM

All replies

  • User2092378267 posted

    I got the answer:

    protected void btn_Click (object sender, EventArgs e)
    
    {
    
     Entities.Masters.Country country = new Entities.Masters.Country();
     country.Id = Convert.ToInt32(CountryIdHiddenField.Value);
     Country_Bal contractBal = new Country_Bal();
     contractBal.GetCountries(country);
    
    }

    Saturday, August 29, 2020 12:15 PM