locked
Passing parameters to the java script in the edit modal window RRS feed

  • Question

  •                 
    <script type="text/javascript">
    $ (Document). Ready (function () {
    $ ('A [name = modal]'). Clique (function (e) {e.preventDefault ();
    id = var $ (this) attr ('href').;
    . var maskHeight = $ (document) height ();var maskWidth = $ (window) width ().;
    . $ ('# Máscara') css ({'width': maskWidth, 'height': maskHeight});
    $ ('# Máscara') fadeIn (1000).;$ ('# Máscara') fadeTo ("lento", 0,8).;
    / / Pega uma Altura da Janela e LARGURAvar winH = $ (window) height ().;var Winw = $ (window) width ().;
    $ (Id) css ('top', winH / 2 - $ (id) Altura () / 2.);.. $ (Id), CSS ('Esquerda', Winw / 2 - $ (ID) LARGURA () / 2.);
    . $ (ID) fadeIn (2000);
    });
    $ ('. Janela. Close'). Clique (function (e) {e.preventDefault ();
    . $ ('# Máscara') hide ();. $ ('. Janela') hide ();});
    $ ('# Máscara "). Clique (function () {. $ (Este) hide ();. $ ('. Janela') hide ();});
    });
    </ Script>

    type = "text / javascript"> <roteiro . $ (document) ready (function () { $ ('a [name = modal]') click (function (e) {. e.preventDefault (); . var id = $ (this attr) ('href'); var maskHeight = $ (document) height ();. var maskWidth = a Altura da Janela e LARGURA var winH = $ (window) height ();. . var Winw = $ ( janela) largura (); .. $ (id) css (winH/2- $ (id 'top',) Altura () / 2); .. $ (id) css ('Esquerda', winW/2- $ (id) width () / 2); $ (id) fadeIn (2000);.  }); $ ('... Janela fechar ") click (function (e) { e.preventDefault (); $ ('# mascarar ') hide ();. $ ('Janela ") hide ();.. }); $ ('# mask ") click (function () {. $ (this Esconder) ();. . $ (' . Janela ') hide (); }); }); </ script> <tipo style = "text / css"> body { font-family: Verdana; font-size: 15px; } a {color: # 333; text-decoration: none} a: hover {color: # ccc; text-decoration: none} # Máscara {           background-color: # 000;   exibição : none; } # Caixas de Janela. # Diálogo {   width: 375px;    height: 203px;   padding: 10px;   background-color: # ffffff; } # # Caixas Diálogo1 {   width: 375px;    height: 203px; } # Diálogo1 d- . header {   background: url (login-cabeçalho. png) no-repeat 0 0 transparente;    width: 375px;    height: 150px; } # Diálogo1 Entrada d-header {.       Esquerda: 100px;   Margem: 3px solid # CCCCCC;   height: 22px;   LARGURA : 200px;   font-size: 15px;   padding: 5px;   margin- } . # Diálogo1-d {Branco   float: left;   background: url (login-blank.png) no-repeat 0 0 transparente;    width: 267px;    height: 53px; } . # Diálogo1 d-login {   float: left;   width: 108px;    height: 53px; } # # Caixas dialog2 {   background: url (notice.png) no-repeat 0 0 transparente;    LARGURA: 326px;    height: 229px;   padding: 50px 0 20px 25px; } Perto {display:. block; text-align: right;} </ style>

    <asp:GridView ID="gridDados" runat="server" ItemType="Models.Categoria.CategoriaModel" SelectMethod="CarregarGrid" DataKeyNames="Id" OnRowCommand="gridDados_RowCommand"><colunas><asp:TemplateField ShowHeader="false"><ItemTemplate><Asp: LinkButton ID = runat "LinkButton1" = "server" CausesValidation = "false" CommandName = "Excluir" OnClientClick = "Confirmar Retorno ('Deseja excluir?')" CommandArgument = '<% #: Item.Id%>' Text = "Excluir"> </ asp: LinkButton></ ItemTemplate></ Asp: TemplateField><asp:TemplateField ShowHeader="false"><ItemTemplate><Asp: LinkButton ID = "LinkButton2" runat = "server" CausesValidation = "false" CommandName = 'editar' CommandArgument = '<% #: Item.Id%>' Text = 'editar'> </ asp: LinkButton></ ItemTemplate></ Asp: TemplateField></ Columns></ Asp: GridView>

    <li> <a href="#dialog" name="modal"> INSERIR Categoria </ a> </ li><asp:HiddenField runat="server" ID="hdn" />
    <div id="boxes"><div id="dialog" class="window"><a href="#" class="close"> Fechar [X] </ a> <br />Janela Modal Simples <br /> <asp:FormView runat="server" ID="FormCadastro" DefaultMode="Insert" ItemType="Models.Categoria.CategoriaModel" InsertMethod="FormCadastro_InsertItem" CellPadding="4" ForeColor="#333333" DataKeyNames="Id"><InsertItemTemplate>Nome: <br /><Asp: TextBox ID = "txtNome" runat = Texto "servidor" = '<% # BindItem.Nome%>' /><br />ENDEREÇO: <br /><Asp: TextBox ID = "txtDescricao" runat = Texto "servidor" = '<% # BindItem.Descricao%>' /><br /></ Br><br> </ br><asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Salvar" /><asp:Button ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
    <asp:ValidationSummary runat="server" ID="validation" DisplayMode="BulletList" ShowSummary="true" ForeColor="Red" />
    </ InsertItemTemplate><FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /></ Asp: FormView></ Div><div id="mask"> </ div></ Div>

    <table><tr><td> Nome: </ td><td><asp:TextBox ID="txtNomeModal" runat="server" /> </ td></ Tr><tr><td> Descriçãp: </ td><td><asp:TextBox ID="txtDescricaoModal" runat="server" /> </ td></ Tr></ Table>
                <div style="text-align:center;"><asp:Button ID="btnSalvar" runat="server" Text="Salvar" OnClick="btnSalvar_Click"/><asp:Button ID="btnCancelar" runat="server" Text="Cancelar" /></ Div>


    I wonder how do I rrecuprar data grid, when I click the edit button. I need to load a modal window with the data retrieved from the grid. 
    I already did the modal window to enter, and it's all right, but I need to edit the modal window. 
    anyone know how to do it?

























































































































    Sunday, May 4, 2014 2:15 AM