How to call javascript by passing multiple arguments from c# -


can please tell me how pass arguments javascript c#?

i used this.page.clientscript.registerclientscriptblock, not calling method.

sqldataadapter da = new sqldataadapter();da = o1.viewthisaddmorefields(convert.toint32(id));     datatable dt = new datatable();     da.fill(dt);     int count = dt.rows.count;     (int = 0; < count; i++)     {       extrafieldname[i] = dt.rows[i]["fieldname"].tostring();       extrafieldvalue[i] = dt.rows[i]["fieldvalue"].tostring();    }     (int = 0; < count; i++)    {                     modalpopupextender1.hide();                   modalpopupextender2.hide();                   page.clientscript.registerarraydeclaration("extrafname", "extrafieldname[i]");                   page.clientscript.registerarraydeclaration("extrafvalue", "extrafieldvalue[i]");                   page.clientscript.registerarraydeclaration("totalcount", "count");                    // clientscript.registerstartupscript(gettype(), "javascript", "javascript: morefieldseditfunction(); ", true);"+extrafieldname[i].tostring()+","+extrafieldvalue[i].tostring()+"                  }               (int = 0; < count; i++)               {                 // clientscript.registerstartupscript(gettype(),"javascript", "javascript: morefieldseditfunction('hai','hello');", true);                   this.page.clientscript.registerclientscriptblock(this.gettype(), "xx", "<script>morefieldseditfunction(" + extrafieldname[i] + "," + extrafieldvalue[i] + ");</script>");              } 

javascript code is:

 function morefieldseditfunction(extrafname,extrafvalue) {            alert(extrafname + "test" + extrafvalue + "helloooooo");       } 

is format correct?

i can able call using single parameter, when passing 2 parameters not working. syntax error?

pass name in single quotes string variables need passed in quotes.

this.page.clientscript.registerclientscriptblock(this.gettype(), "xx", "<script>morefieldseditfunction('" + extrafieldname[i] + "','" + extrafieldvalue[i] + "');</script>"); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -