Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/01/2010, 09:46
LOD_Fredy
 
Fecha de Ingreso: abril-2009
Mensajes: 341
Antigüedad: 15 años
Puntos: 3
Ayuda con JQGrid y SqlDataSource

Modifico el post, y solucione ese problema.

Ahor necesito hacer lo siguiente:

Ya que lo que debo hacer es simular una hoja de excel en la web (de ahi el que use el jqgrid), necesito poder editar directamente en la celda del grid y que se modifique al momento de cambiar de celda o dar enter. Ademas necesito que las cabeceras del grid quede como lo muestra la hoja de excel, la subi a medifire:

EJEMPLO EN EXCEL

Como podran notar, de una columna surgen debajo 2 o mas, esto es lo que no se hacer en el jqgrid y no veo una opcion que de a entender que se puede hacer eso.

Dejo tmb el codigo de la pagina para que vean lo que he utilizado del jqgrid. Se que hay otra forma de usar el jqgrid (usando el script para crear el grid) pero no se como enlazar los datos del sqldatasource. Si saben hacer lo segundo y hacer de esta forma el grid me permite hacer lo que necesito por favor denme un ejemplo.

Código:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Prueba.aspx.cs" Inherits="Prueba" %>
<%@ Register Assembly="Trirand.Web" TagPrefix="trirand" Namespace="Trirand.Web.UI.WebControls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>PÁGINA DE PRUEBA</title>
<!-- The jQuery UI theme that will be used by the grid -->
    <link rel="stylesheet" type="text/css" media="screen" href="themes/custom-theme/jquery-ui-1.7.2.custom.css" />
    <!-- The jQuery UI theme extension jqGrid needs -->
    <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" />
    <!-- jQuery runtime minified -->
    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <!-- The localization file we need, English in this case -->
    <script src="js/i18n/grid.locale-sp.js"type="text/javascript"></script>
    <!-- The jqGrid client-side javascript -->
    <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>    
</head>
<body bgcolor="#000000" text="#ffffff">       
    <!--
    <%                     
        ManejadorBD manejador=new ManejadorBD();
        Table tabla=new Table();        
        manejador.Consulta="select * from soluciones";
        manejador.EjecutaConsulta();
        //tabla= manejador.Tabla;
        Response.Write("<form id=forma1 action=" + "'Default.aspx' method=" + "'post'><table border=10px>");
        for (int i = 0; i < 10; i++)
            Response.Write("<th>" + i + "</th>");
        Response.Write("<tr>");
        for(int i=0;i<10;i++)            
            
        Response.Write("<td><input type=text name=nombre>dsads</td>");
        //Response.Write("<td><input type=text name=nombre>dsads</td>");
        Response.Write("</tr></table></form>");
     %>
        -->
        
     <center>     
     <form id="form1" runat="server">
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT num_tecnico, iniciales, nombre, correo FROM TECNICOS"
            DeleteCommand="DELETE FROM TECNICOS WHERE num_tecnico = @num_tecnico" 
            InsertCommand="INSERT INTO TECNICOS(iniciales, nombre, correo) VALUES (@iniciales, @nombre, @correo)" 
            UpdateCommand="UPDATE TECNICOS SET iniciales = @iniciales, nombre = @nombre, correo = @correo WHERE num_tecnico = @num_tecnico">
        <DeleteParameters>
            <asp:Parameter Name="num_tecnico" Direction="Input" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="iniciales" Direction="Input" Type="String" />
            <asp:Parameter Name="nombre" Direction="Input" Type="String" />
            <asp:Parameter Name="correo" Direction="Input" Type="String" />
            <asp:Parameter Name="num_tecnico" Direction="Input" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>            
            <asp:Parameter Name="iniciales" Direction="Input" Type="String" />
            <asp:Parameter Name="nombre" Direction="Input" Type="String" />
            <asp:Parameter Name="correo" Direction="Input" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>      
    
    <trirand:JQGrid runat="server" ID="JQGrid1" DataSourceID="SqlDataSource1" AppearanceSettings-Caption="TECNICOS"
     Width="600" Height="230" AddDialogSettings-LoadingMessageText="Cargando...">     
        <Columns>            
            <trirand:JQGridColumn HeaderText="No" DataField="num_tecnico" PrimaryKey="True" Width="5" TextAlign="Center" />
            <trirand:JQGridColumn HeaderText="Iniciales" DataField="iniciales" Editable="true" Width="5" TextAlign="Center" />
            <trirand:JQGridColumn HeaderText="Nombre" DataField="nombre" Editable="true" Width="25" TextAlign="Center" />
            <trirand:JQGridColumn HeaderText="Correo" DataField="correo" Editable="true" Width="20" TextAlign="Center" />                        
        </Columns>        
        <ToolBarSettings ShowEditButton="true" ShowRefreshButton="True" ShowAddButton="true" ShowDeleteButton="true"
            ShowSearchButton="True" />
    </trirand:JQGrid>                   
    
    </form>
    </center>
</body>
</html>
Gracias a todos y disculpen que nomas me la pase pregunte y pregunte pero no es algo mio y tengo 2 semanas para terminarlo.

Última edición por LOD_Fredy; 17/01/2010 a las 00:00