Thursday, July 9, 2009

C# Function Parameter?

How do you pass a value (string) from the ASP.NET page to the code behind page function, then pass the result back?

C# Function Parameter?
to extract the string from some control say textbox, use this code





say textbox has the name or id





textbox1 then





string str = textbox1.Text;





then pass this string to the function say you have a function





public void myFunction(String text){ //do something}





you just pass the extracted string to this function by calling it in the even handler you are implementing





myFunction(str);





then if you want to repost the resulted value





you just set the text property if you need to show the result in some textbox, richtextbox or label





just set the resulted value to the text of desired contorl as





someContorl.Text = result; // suppose result is your processed result.





Saif Ullah





http://www.kasamba.com/Saif-Ullah

sweet pea

0 comments:

Post a Comment