This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - How can I set a label's text value from server side?

[email protected] - Monday, August 29, 2011 2:51 PM:

Hi, All:

I would like to set the text value of a label from a C# server method.  Normally I would simply write "lblResult.Text = some value' "  but that doesn't work in ARAS.  Here is what I've got so far (I'm calling a web service):

ARAS_ws.cdc20.CDC_WebService ws = new ARAS_ws.cdc20.CDC_WebService();

string[] myArray = ws.getLocations();

string s = "";

foreach(string str in myArray)

{

s += str + " , " ;

}

lblResult.Text = s;  //This is the line that fails.  It doesn't throw an error, it just doesn't work.

return this.getInnovator().newError(s);  //I'm using newError to check the results of the web service, just a temp.

The web service works correctly.  When I use "run Server method" the return statement pops up a window with a short string value that I want to display to the user on a label, so I know it's working.  The form this is attached to has a label named lblResult.  Doing this would be very simple in Visual Studio, but I can't figure out how to do it in ARAS.  Any ideas?

Thanks much,

Jeremy B.



Brian - Tuesday, August 30, 2011 6:37 AM:

Hi Jeremy,

Labels etc. are on the client side. You can't affect what's on the client side from the server side except by passing values back to the client. Which is what the "newError(..)" & "newResult( )" methods do for you

The "run server method" action is a convenience method that allows you to test your server side code without having to call it from a Server Event or an Action.

I haven't tried to do much with Web services but can't you call it from the client side (javascript) and then set the label on the client side from the return values directly?

If you can't do that then you will need to put the labels into an Item to pass back to the Client side and have some calling code (javascript) extract the labels and apply them to the Client interface.

Hope this helps,

Brian.



[email protected] - Tuesday, August 30, 2011 10:36 AM:

Thanks, Brian.  I replied in the other post.  This was a big help.

-Jeremy B.