0

Here is my code:

Response.Write("window.open('loginfo.aspx?id=" + btn.CommandArgument 
"','height=200,width=200,alwaysRaised=yes')"); 

But still it didn't work as new window instead of new tab.

Now I got like shows data in gridview in new tab, but I need to show like new window.

For that what should I 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);           
        }
pcs
  • 1,864
  • 4
  • 25
  • 49
  • You can use `Thickbox.js` for this purpose. – Suprabhat Biswal Jan 06 '16 at 05:53
  • @SuprabhatBiswal: can you show sample code?.. – pcs Jan 06 '16 at 06:02
  • Sorry, I don't have enough time to create a sample for you. You can search for live demo in google. Here's one [Thickbox](http://codylindley.com/thickbox/) – Suprabhat Biswal Jan 06 '16 at 06:55
  • @SuprabhatBiswal: can you please see my updated post? – pcs Jan 06 '16 at 06:56
  • `window.open` creates a new window. You need a `Modal` to show data, there is no built in method in javascript to do that. You'll have to use a library which does it for you. 2 users have suggested you 2 different and very nice libraries. Go to the documentation, read it and use it. Don't ask for ready to use copy and paste code try to do it yourself. – Shaharyar Jan 06 '16 at 07:05
  • @Shaharyar: I removed modal.. but event it didn't work as per width and height. – pcs Jan 06 '16 at 07:06
  • Which modal you used? Show the code where you used modal and it didn't work. – Shaharyar Jan 06 '16 at 07:07
  • I didn't use modal.. but if i use particular width and height... – pcs Jan 06 '16 at 07:10
  • I referred this link, http://stackoverflow.com/questions/726761/javascript-open-in-a-new-window-not-tab?rq=1 – pcs Jan 06 '16 at 07:14

2 Answers2

0

I suggest you to use FancyBox : GitHub

this is example result on my project...

enter image description here

enter image description here

I need to help you but i not have mor time , sorry !

0

You need to add script> tags and _blank to open it in new window:

Response.Write("<script>window.open('WebForm2.aspx?id=" + btn.CommandArgument + "','_blank', 'height=200,width=200,alwaysRaised=yes')</script>");
Shaharyar
  • 12,254
  • 4
  • 46
  • 66