c# - Using Page.ClientScript.RegisterClientScriptBlock not working -
i trying fire pop shown below, not working. please help public void btnsubmit_click(object o, eventargs e) { if (checkfileexists(convert.tostring(fileinfo))) { page.clientscript.registerclientscriptblock(this.gettype(), "msg", "<script type=\"text/javascript\" language=\"javascript\">function showmsg(){return confirm(\"this image name exists, want replace it?\");}</script>", true); btnsubmit.onclientclick = "return showmsg()"; } if (something else) { // whatever here never pops question above } } and on button have <asp:button class="button" id="btnsubmit" causesvalidation="true" text="submit" runat="server" onclick="btnsubmit_click"></asp:button> the last parameter you're sending registerclientscriptblock true , tells method wrap script in <script> bl...