angel_neo
angel_neo

Reputation: 331

ASP, HyperLink Open small Window

My site has Gridview controls and some of them must have hyperlinks on every record. What I need is that the hyperlink open a new and small window, because i send data from the grids to new window.

This is my GridView:

<asp:GridView ID="gvwCajUpd" runat="server" CssClass="mGrid" AutoGenerateColumns="false"
                                PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" 
                                Font-Size="Smaller" >
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:HyperLink ID="hypCajUpd_CadDet" Text="Detalle" runat="server" target="_blank"
                                                NavigateUrl='<%# "Cajas_Detalle.aspx?cliCod=" + Eval("ClienteCodigo").ToString() 
                                                    + "&cajCod=" + Eval("CajaCodigo").ToString() 
                                                    + "&cajNum=" + Eval("CajaNumero").ToString()
                                                    + "&cajCon=" + Eval("CajaContenido").ToString()
                                            %>'/>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="CLIENTE">
                                        <ItemTemplate>
                                            <asp:Label ID = "lblCajUpd_CliCod" runat="server" Text='<%# Eval("ClienteCodigo") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="COD.CAJA">
                                        <ItemTemplate>
                                            <asp:Label ID = "lblCajUpd_CajCod" runat="server" Text='<%# Eval("CajaCodigo") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="NUM">
                                        <ItemTemplate>
                                            <asp:Label ID = "lblCajUpd_CajNum" runat="server" Text='<%# Eval("CajaNumero") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <!--- more and more data -->

I recieve the data in my new window, but I need this new window small and NOT in in a new tab.

Upvotes: 2

Views: 1623

Answers (3)

angel_neo
angel_neo

Reputation: 331

Thanks a lot aref I could resolve my problem:

<asp:TemplateField>
                                        <ItemTemplate>
                                            <a href="#" onclick="window.open('Cajas_Detalle.aspx?cliCod= <%#Eval("ClienteCodigo").ToString() 
                                                + "&cajCod=" + Eval("CajaCodigo").ToString() 
                                                + "&cajNum=" + Eval("CajaNumero").ToString()        
                                                %> ','PrintMe','height=400px,width=800px,scrollbars=1');">Detalle</a>
                                        </ItemTemplate>
                                    </asp:TemplateField>

Thanks best regards

Upvotes: 0

hossein andarkhora
hossein andarkhora

Reputation: 798

why do you want use hyperlink , Use this code instead

<asp:TemplateField>
     <ItemTemplate>
       <a href="#" onclick="window.open('Sample.aspx?id= <%#Eval("UserCourseId") %> ','PrintMe','height=700px,width=500px,scrollbars=1');">SomeText</a>
     </ItemTemplate>
 </asp:TemplateField>

Upvotes: 3

Ambrish Pathak
Ambrish Pathak

Reputation: 3968

This can be done like this:

Instead of NavigateUrl use OnClick with javascript function that will open a small new window like the way you want.

NavigateUrl="#"        
onClick='<%# "window.open('Cajas_Detalle.aspx?cliCod=" + 
                      Eval("ClienteCodigo") + "&cajCod=" + Eval("CajaCodigo") + 
                      "&cajNum=" + Eval("CajaNumero") + "&cajCon=" + 
                      Eval("CajaContenido")+ 
                      ",'name','height=550, width=790,toolbar=no,
                      directories=no,status=no,
                      menubar=no,scrollbars=yes,resizable=no'); 
                      return false;%>'  

Let me know if this helps

Upvotes: 0

Related Questions