web sharper control

24 views
Skip to first unread message

Mario Scappaticci

unread,
Sep 16, 2011, 4:21:30 PM9/16/11
to WebSharper
Hi guys,
i need to pass a parameter to a web sharper control from an aspx page.
How can i make it?

thanks in advance!

Anton Tayanovskyy

unread,
Sep 16, 2011, 4:23:43 PM9/16/11
to websh...@googlegroups.com
Something along these lines:

[<Sealed>]
type MyControl() =
inherit Web.Control()
let mutable value = "?"

member this.MyParameter with get x = value and set x = value <- x

[<JavaScript>]
override this.Body = Div [Text value] :> _

And then:

<MyControl MyParameter="foo" />

Hope it helps!

--A

--
Kind Regards,
Anton Tayanovskyy

WebSharper™ - type-safe JavaScript in F#
http://intellifactory.com

Mario Scappaticci

unread,
Sep 19, 2011, 4:05:36 AM9/19/11
to WebSharper
Thanks fro reply Anton!
I have the following error on the get method:

The property 'MyParameter' has the same name as another property in
this type, but one takes indexer arguments and the other does not. You
may be missing an indexer argument to one of your properties.

any suggestion?

Mario Scappaticci

unread,
Sep 19, 2011, 4:27:05 AM9/19/11
to WebSharper
problem solved substituing get x with get()..

thanks again Anton!

On Sep 19, 10:05 am, Mario Scappaticci <mario.scappati...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages