locked
Help with [WebMethod] RRS feed

  • Question

  • User-2134351927 posted

    Hi Is there anyway to access the value of a form control from within a static WebMethod?  For example allowing a user to select a value that is passed to a method which in-turn passes a paramter to a store procedure?  This is set on the form by the user:

        [WebMethod]
        public static string GetDataForEventChart()
        {
            string theValue = theControlUserSelectsFrom.SelectedItem.Value.ToString();
    
            return DataForEventChart(theValue);
        }
    

    I need an object referance but am struggling to figure it out.

    Thanks so much for any help!

    Thursday, January 31, 2013 3:19 PM

Answers

  • User-1360095595 posted
    Send the value as a parameter the webmethod and avoid tightly coupling the webmethod to a control.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 31, 2013 3:40 PM