Passing parameters from ASP.NET to JS

Great Script! Thank You!!!

However I have little problem Sticking out tongue
I have not work very much with java script... So...

How can I pass parametar from Asp.Net to JS?


var swfu;
window.onload = function () {
swfu = new SWFUpload({
// Backend Settings
upload_target_url: "upload.aspx?details=239",
...

It works this way, only for ID 239 ofc...
I don't know how to pass ID from ASP.NET?
What is the simplest why to pass parameter?

I could call JS directly from "cs page", convert it to string, and...
But I believe there is much simpler way...

Can somebody please help me?

gyphie's picture

What I do is...

I create a public (or protected) property (or Field) in the Codebehind:


public string SomeValue;

Page_Load(.......) {
this.SomeValue = "The thing I want to pass.";
}

Then in the HTML I just write it out:


upload_target_url: "upload.aspx?details=<%=SomeValue%>"

This is also how I get an ASP.Net Control's ID:


var textbox = document.getElementById("<%=txtMyTextBox.ClientID%>");

THANK YOU! It works I tried

THANK YOU!
It works Smiling

I tried something similar

<% Response.Write(something); %>

but it didn't work..