Saturday, December 18, 2010

JavaScript and SilverLight

I was trying out some SilverLight usig the project Template from VS Web developer and I wanted to to spawn a simple alert .
To register JavaScript from MailPage.xaml.cs, you need to HtmlPage.RegisterScriptableObject("Page", this);
and use the HtmlPage.Window.Invoke("<jsfunctionname>","<parameter>")

and from JavaScript in Silerlightap...aspx add a function with a simple alert mesaage, a parameter can be used as well
 in xaml:
<Grid x:Name="LayoutRoot" Background="White">
        <TextBlock x:Name="text">text</TextBlock>
  </Grid>
If you have a TextBlock in xaml then that textblock can be accessed from the cs and by using the attribute
[ScriptableMember]   you can write a function to modify some text value the cs, and since its ScriptableMember the value can be passes from JavaScript.

I think the syntax in JavaScriot would be something like
document.getElementById('silverlightControl'); //get the control having a textbox
page.<cs function>(some value);
and this would have the value in the silverlight control

I had read somewhere about this and I cannot find it now, I will do a test ASAP

Wednesday, December 15, 2010

Content Editor WebPart

Is there a way to show an Image on top of the MasterPage of SharePoint portal
I think using a content editor webpart, we can add a div tag with style of position:absolute
like <div style="position: absolute; left: 10px; top: 10px; height: 400px; width: 100px; "><img src=... /></div>

I will try this and update...

Saturday, December 4, 2010

js Calender

This one is probably the best I've seen and has some cool features like multiple date selection, but the best feature it says on the site, that I liked is that it does not depend on any 3rd party library, I haven't tested it but it good on the site
http://www.dynarch.com/projects/calendar/
I downloaded the source, that has a really cool demo,
got to their downloads page http://www.dynarch.com/projects/calendar/download/
much more stuff at  http://www.dynarch.com/