c# - ASP.Net LinkButton works local but not on Server -
well, bet case "this works on machine".
the problem is:
i have linkbutton in gridview:
<asp:templatefield headertext="website"> <itemtemplate> <asp:linkbutton id="l_website" causesvalidation="true" runat="server" text='<%# eval("l_website") %>' commandargument="gotowebsite" onclientclick="return confirm('are sure want go website?');" commandname="gotowebsite"></asp:linkbutton> </itemtemplate> </asp:templatefield> which fill data datareader:
dr["l_website"] = convert.tostring(reader["l_website"]); maybe want see gotowebsitecode:
protected void gv_contacts_rowcommand(object sender, gridviewcommandeventargs e) { string id = string.empty; string status = string.empty; if (e.commandname == "edit") { //code here } else if (e.commandname == "view") { //code here } else if (e.commandname == "gotowebsite") { linkbutton lb = (linkbutton)e.commandsource; gridviewrow gvr = (gridviewrow)lb.namingcontainer; linkbutton linkbutton = gvr.cells[8].controls[1] linkbutton; if (linkbutton.text.substring(0, 3) == "www") { system.diagnostics.process.start(linkbutton.text); } else { system.diagnostics.process.start("www." + linkbutton.text); } } } it works fine on local machine. getting displayed, , if click on it, local version makes confirmation, , opens new tab page. on server (iis 6.0) gets displayed right, if click on it, also makes confirmation, doesn't open new tab page.
if change causesvalidation, doesn't work.
if have noonclientclick, doesn't work.
if go (hover) on linkbutton, shows me makes postback.
already thank :)
you not thinking "client / server" like.
what doing starting process. working , visible on local development machine, because sitting in front of monitor , can see such processes.
you starting processes on server well, there's nobody there see them. log onto server , watch task manager.
you must find solution opens link on client side of code, not on server side. (all can done html , javascript, no postback necessary.)
Comments
Post a Comment