Question : Javascript to Silverlight (VB)

Hi All,

I'm trying to have a drop down list in my asp.net pass the value to my silverlight application.  However, the value is always being set as 0, and the alert is never fired.  

Help?

silverlight header:
    <ScriptableMember()> Public Sub UpdateSubSiteID(ByVal subsite As Integer)


my aspx.vb:
 Protected Sub ddlSubSites_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlSubSites.SelectedIndexChanged
        Page.ClientScript.RegisterClientScriptInclude("Floorplan.aspx.js", "~/FloorPlan.aspx.js")
        Dim sb As New StringBuilder

        sb.Append("<script type=""text/javascript"" language=\""javascript\"">" + vbNewLine)
        sb.AppendFormat("var subsite = " + ddlSubSites.SelectedValue.ToString() + ";" + vbNewLine)
        sb.Append("</script>" + vbNewLine)

        ClientScript.RegisterStartupScript(sender.GetType, "UpdateSS", sb.ToString())
    End Sub

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
//.JS FILE
function UpdateSS(subsite) {
    
// Not even being called?
        alert(subsite);
        
        var control = document.getElementById("SilevrlightFloorplan");
        if (control) 
        {
            //3001 should be subsite, but debugging.
            control.Content.Page.UpdateSubSiteID(3001);
        }
}

Answer : Javascript to Silverlight (VB)

Random Solutions  
 
programming4us programming4us