Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Interaction between Silverlight controls
2 replies. Latest Post by ladito9482 on May 20, 2008.
(0)
ladito9482
Member
2 points
3 Posts
05-20-2008 10:49 AM |
Hi all,
My idea is to use Silverlight controls in my aspx. Perhaps this is not the way Silverlight should be used but I think It could be an interesting feature for ASP.NET.
I`ve an ASP.NET Web Page which have three <asp:Silverlight controls. One have a textbox, the other is a grid and the tirdth is a button. I use the same .xap an I pass the type of the control I want to load in the InitParameters. Then in the Application_Startup I create the control depending on the parameters (This way was expained in some post in this forum)
Now I would like to add an item to the grid when the button is clicked. The text of this item comes from the textbox :)
[
{
InitializeComponent();
}
ButtonClicked(sender, e);
and
alert("Se pulso el boton");
The problem I`m facing now is that I`m not able to interact between controls from javascript. For example, get the text from textbox or add values to the grid.
Is there any solution?
Thanks in advance
Jabb
462 points
81 Posts
05-20-2008 11:05 AM |
If you want to get the text from the textbox and then add it to the grid, you have to add scriptable functions in the Silverlight code to do so and then call those methods from JavaScript.
Unless you *reaaaally* have a requirement for this kind of architecture, I would advise against it. You decrease your performance and at the same time increase your code and architecture complexity by running components in separate plugins and hooking them together with JavaScript when they should all be running under the same plugin - this is analogous to making a Windows program with a Textbox, another with a Grid, a third with a Button, and making them talk to each other via DCOM. Yes, you can do it, but I pity the fool who has to maintain it down the road
05-20-2008 11:26 AM |
Thanks Jabb,
Due to your excelent response I'm reading Walkthrough: Calling Managed Code from Client Script now
Thanks !!