-2

I have this: The idea is pass data from code behind to the client, i cant catch the info in the client this is the problem

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) what exactly do you mean by "pass to the client"? and 2) what exactly is your _question_, what problem do you have? – Franz Gleichmann Sep 02 '20 at 17:29
  • I need to pass data from the code Behind, the data is to display in a modal `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"; }` – alberto mora Sep 02 '20 at 17:30
  • please do ***not*** post code in the comments, it's virtually unreadable. **edit** your question instead. and still: what's your problem? – Franz Gleichmann Sep 02 '20 at 17:42
  • Are you trying to pass information from server-side code (C#) into client-side code (HTML)? You could just register a hidden placeholder that is viewed from the server-side and put the values in those objects. – José Amílcar Casimiro Sep 02 '20 at 17:57
  • Check out [this](https://stackoverflow.com/questions/24250758/setting-a-value-to-a-hiddenfield-in-asp-net-4-5/24251368) answer – Daniel Sep 03 '20 at 08:55

1 Answers1

0

Answer

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

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