Skip to main content

Microsoft Silverlight

Unanswered Question ICallback EventRSS Feed

(0)

chandi
chandi

Member

Member

3 points

22 Posts

ICallback Event

Hi,

  • In my silverlight project pops up a child window. When I click a "OK" button in child window, its call to javascript.

private void OKButton_Click(object sender, RoutedEventArgs e)
{
         HtmlPage.Window.Invoke("CallToServer", controlId,"arg","context");
}

  • CallToServer javascript implement a call back event. So its fire following events.

public void RaiseCallbackEvent(string eventArgument)
{
 //code
}

public string GetCallbackResult()
{
            string s="hello world";

            lblTest="Test";
}

  • lblTest is a Label on my page. I want to change the text of that label as shown in GetCallbackResult() method. But if I change it, it will not display.
  • I know it can do from javascript. But I wont to do it in code behind. Is there any way to do it.

Thanx


 

Maud
Maud

Contributor

Contributor

3358 points

461 Posts

Re: ICallback Event

Hi,

I'm not quite clear about what you attempt to achieve, would you like to explain a little more? If you need interaction between htmlpage and silverlight, this article will be useful

http://msdn.microsoft.com/en-us/library/cc645076(VS.95).aspx

Thanks,

Maud

chandi
chandi

Member

Member

3 points

22 Posts

Re: ICallback Event

Thanx Maud

Actually I want to update my controls with new values returning from GetCallbackResult() method.

Controls such as Textbox, Label, Grid

Thank you

 

Mog Liang - MSFT
Mog Lian...

All-Star

All-Star

16023 points

1,553 Posts

Re: ICallback Event

Hi,

Try put update control code in Dispatcher.BeginInvoke() method.

 

Mog Liang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities