【问题标题】:How to Pass 4 parameters from code code behind to the client如何将 4 个参数从后面的代码传递给客户端
【发布时间】:2020-09-02 17:27:15
【问题描述】:

我有这个:想法是将数据从后面的代码传递给客户端,我无法捕获客户端中的信息这是问题

string name="Juan Pérez";
            string date = "06/07/2020";
            string num1 = "2020-00001";
            string num2 = "2020-0022";

ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "mensajeRecibo("+date+","+ num1+","+name+","+num2+");", true);

【问题讨论】:

  • so... 1)“传递给客户”到底是什么意思? 2)你的问题到底是什么,你有什么问题?
  • 我需要从代码后面传递数据,数据是以模态显示的function mensajeRecibo(fecha, numvisado, nombre, minuta) { document.getElementById('fechaImpresion').value = nombre; document.getElementById('Label1').value = nombre; document.getElementById('Label2').value = nombre; document.getElementById('Label3').value = nombre document.querySelector('.bg-modal').style.display = "flex"; }
  • 请在 cmets 中发布代码,它几乎不可读。 编辑 你的问题。仍然:你有什么问题?
  • 您是否尝试将信息从服务器端代码 (C#) 传递到客户端代码 (HTML)?您可以只注册一个从服务器端查看的隐藏占位符并将值放入这些对象中。
  • 查看this答案

标签: c# webforms


【解决方案1】:

回答

string test="hi";
string test2="hi2";

ScriptManager.RegisterStartupScript(this, this.GetType(), "key", string.Format("mensajeRecibo('{0}','{1}')", test,test2), true);

【讨论】:

    猜你喜欢
    • 2014-04-05
    • 2019-03-16
    • 1970-01-01
    • 2014-09-26
    • 2013-06-22
    • 1970-01-01
    • 2016-05-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多