javascript - generating dynamic click event in code behind -


i generating dynamic html in visual webpart in sharepoint.

 htmlstring = "<a href='#'  onclick='updateage(" + itemid + ")'>"; 

i want write click event in code behind in c# click event. click event should accept parameter.

how achieve this? can javascript writing function not sure how in code behind.

assuming resolved how send link html , need send javascript, use page.clientscript.registerstartupscript

string script = @"function updateage(itemid) {      // here write logic!     alert(itemid);     someotherfunction(); }  function someotherfunction() {     // logic other function }"; page.clientscript.registerstartupscript(gettype(), "myscript", script, true); 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -