c# - Code Behind executes but not the intended JavaScript -


i working on site company work in can have overview of activities got going saving , earning money company.

it's made asp.net have small issue. when user added activity redirected site shows pending activities (as need approved before put in production). when arrive @ new page want use bootstrap modal placed on page tell them id of new activity doesn't work (however below works on other pages use it, though have not used after redirect anywhere else).

it redirects correct page alert doesn't appear. below code use when loadcomplete event fires:

void pending_loadcomplete(object sender, eventargs e) {     if (request.querystring.count != 0)     {         string query = request.querystring.get(0);         string jsexec = util.modalalert(query, "#info_modal", ".modal-body");         scriptmanager.registerstartupscript(page, gettype(), "modalalertshow", jsexec, false);     } } 

the util.modalalert() method:

public static string modalalert(string message, string modalid, string modalbodyid) {     stringbuilder sb = new stringbuilder();     sb.appendline("<script type='text/javascript'>");     if (modalbodyid.startswith("."))     {         sb.appendline("$('"+ modalid + " " + modalbodyid + "').html('" + message + "');");     }     else     {         sb.appendline("$('" + modalid + modalbodyid + "').html('" + message + "');");     }      sb.appendline("$('" + modalid + "').modal('show');");     sb.appendline("</script>");     return sb.tostring(); } 

i checked in debugger code runs , does, alas modal not appear on page redirect to. modal body doesn't have text supposed in it. it's empty. have suspicion page reloads when fire script or loadcomplete doesn't work think does.

any idea why?


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -