Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the problems with the JavaScript function of C #

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "what are the problems of the JavaScript function of C #". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

How do I access C # variables in the JavaScript function? The answers are as follows:

Method 1: 1. Access through hidden fields on the page

< input id="xx" type="hidden" runat="server">

Method 2: 1. If the background defines the format of referencing this variable in the PUBLIC STRING N; foreground js as'

< =n %>

'or' +

< =n %>

+ "

Method 3: or you can register a script on the page after the server-side variable assignment

"

< cript language='javascript'>

Var temp= "+ tmp +"

< /script>

"tmp is a background variable, and then temp can be accessed directly in js to get the value.

How do I access the existing variables of the JavaScript function in C #? The answers are as follows:

Method 1:

1. The foreground uses static text controls to hide the field and write the value of the js variable into it.

2. The background uses request ["id"] to get the value.

Method 2: you can use cookie or session

How to access the JavaScript function in C #? The answers are as follows:

Execute the JavaScript function in the c # code:

Method 1. Page.RegisterStartupScript ("ggg", "")

Method 2: use the Literal class, and then

Private void Button2_Click (object sender, System.EventArgs e) {string str; str= "; / / Literal1.Visible=true; Literal1.Text=str;}" what are the problems with the JavaScript function of C# ", thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report