c# - How to use new window instead of new tab display gridview data on click event in .net? -
here code:
response.write("window.open('loginfo.aspx?id=" + btn.commandargument "','height=200,width=200,alwaysraised=yes')"); but still didn't work new window instead of new tab.
now got shows data in gridview in new tab, need show new window.
for should do?
update:
<asp:templatefield headertext="log info"> <itemtemplate> <asp:button runat="server" id="btnloginfo" text="log-info" commandargument='<%# eval("book_id") %>' onclick="loginfo_click"/> </itemtemplate> <controlstyle backcolor="#ff0066" forecolor="white" /> </asp:templatefield> cs:
protected void loginfo_click(object sender, eventargs e) { button btn = (button)(sender); scriptmanager.registerstartupscript( this, gettype(), "open_window", "window.open('loginfo.aspx?id=" + btn.commandargument + "','height=200,width=200,alwaysraised=yes')",true); }
you need add script> tags , _blank open in new window:
response.write("<script>window.open('webform2.aspx?id=" + btn.commandargument + "','_blank', 'height=200,width=200,alwaysraised=yes')</script>");
Comments
Post a Comment