简体   繁体   中英

Fire JS function from file in ASPX Code Behind

Suppose I have a reference to a .js in a master ASPX. In my code behind on the partial ASPX, I am populating a multiview with the details (CBL) of the entry the user selected.

I want to fire off a JS function from server-side depending on the selected state of the CB. I'm running into difficulty with the syntax for this, and sadly jquery isn't an option.

There are no errors to the console, nor is the JS breakpoint hit.

Page.ClientScript.RegisterStartupScript(this.GetType(), "someString", "Foo('" + CBL.ClientID + "')", true);

Anyone have any thoughts?

This was a bad architecture design by me. Since I am handling this during the initial page draw, I went ahead and handled it in the code behind.

Since the values were already recorded, I just ran everything through a series of switch statements. The key is to ensure that the controls are configured to runat="server".

Hope this helps someone else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM