Sameeeh Sameeeh - 1 month ago 9
ASP.NET (C#) Question

can someone help me with this gridview and fancybox?

i have a button in a gridview and i cant put in the buttonfield class so i can call the fancybox can someone help me with some options?

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
CssClass="table table-bordered bs-table"

allowpaging="True" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" EnableModelValidation="True">
<HeaderStyle BackColor="#FE2E2E" Font-Bold="true" ForeColor="white" />
<Columns>
<asp:BoundField DataField="Nombre" HeaderText="Nombre" ReadOnly="True" SortExpression="Nombre" ControlStyle-Width="70px" >
</asp:BoundField>
<asp:BoundField DataField="FechaNac" HeaderText="FechaNac" SortExpression="FechaNac" >
</asp:BoundField>
<asp:BoundField DataField="Teléfono Casa" HeaderText="Teléfono Casa" SortExpression="Teléfono Casa" />
<asp:BoundField DataField="Teléfono Celular" HeaderText="Teléfono Celular" SortExpression="Teléfono Celular" />
<asp:BoundField DataField="Edad" HeaderText="Edad" SortExpression="Edad" ReadOnly="True" />
<asp:BoundField DataField="Estatus" HeaderText="Estatus" SortExpression="Estatus" ReadOnly="True" />
<asp:BoundField DataField="Atendido por" HeaderText="Atendido por" SortExpression="Atendido por" ReadOnly="True" />
<asp:ButtonField CommandName="Select" ControlStyle-CssClass="btn glyphicon glyphicon-earphone" />
</Columns>
</asp:GridView>

Answer

If you want to add it on select command add DatosCiudadanos class to your button field :

<asp:ButtonField CommandName="Select" ControlStyle-CssClass="btn glyphicon glyphicon-earphone DatosCiudadanos"  />

add provide the aspx page in href property :

<script type="text/javascript"> $(document).ready(function () {
         $(".DatosCiudadanos").
              fancybox(
              {
                  'autoScale': false,
                  'transitionIn': 'none',
                  'transitionOut': 'none', 'width': 680,
                  'height': 450,
                  'type': 'iframe',
                  'href': "/youraspxpage.aspx"
              }
              );
     });
</script>
Comments