By clicking on the DIV clear textbox

0

I have a DIV that opens a modal, but I would like it when I click, clear the textbox, here is where I have the DIV that when clicking opens the modal:

 <div class="link-box">
                <a href="#dialog" name="modal" class="linkmodal" runat="server" id="modalExercutar">Cadastro de agenda avaliação física</a>
            </div>

I tried to do a function in JS but it did not work.

I also wanted to clear only the gridview selection. Ex: click to select a row, when clicking the linkmodal, leave no row selected.

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" DataKeyNames="id" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" PageIndex="10" SelectedIndexChanged="GridView1_SelectedIndexChanged" TabIndex="10" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound" OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_RowEditing" OnSelectedIndexChanged="GridView1_SelectedIndexChanged1" PageSize="1000000">
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <Columns>
                        <asp:BoundField DataField="id" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="id" />
                        <asp:BoundField DataField="data" HeaderText="Data" SortExpression="data" DataFormatString="{0:d}" HtmlEncode="False" />
                        <asp:BoundField DataField="hora" HeaderText="Hora" SortExpression="hora" HtmlEncode="False" />
                        <asp:BoundField DataField="avaliador" HeaderText="Avaliador" SortExpression="avaliador" HtmlEncode="False" />
                        <asp:BoundField DataField="Aluno" HeaderText="Aluno" SortExpression="Aluno" HtmlEncode="False" />
                        <asp:BoundField DataField="razao_social" HeaderText="Empresa" SortExpression="razao-social" HtmlEncode="False" />
                        <asp:ButtonField CommandName="Select" Text="<img src='images/icon/Misc-Edit-icon.png' title='Editar'/>" />
                        <asp:CommandField ShowDeleteButton="True" DeleteText="<img src='images/icon/Trash-can-icon.png' title='Excluir' />" />
                    </Columns>
                    <EditRowStyle BackColor="#999999" />
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                </asp:GridView>
    
asked by anonymous 14.06.2017 / 13:48

1 answer

1

With JS it would look like this:

jQuery(function($){
   $('.linkmodal').click(function(){
        $('#txtid').val('');          
   });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divclass="link-box">
       <a href="#dialog" name="modal" class="linkmodal" runat="server" id="modalExercutar">Cadastro de agenda avaliação física</a>
</div>
<br><br>

Textbox <input type="text" id="txtid" value="teste">

Regarding grid try the following script:

jQuery(function($){
   $('.linkmodal').click(function(){
        $("#GridView1").empty();          
   });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divclass="link-box">
    <a href="#dialog" name="modal" class="linkmodal" runat="server" id="modalExercutar">Cadastro de agenda avaliação física</a>
</div>

<br><br>

<div id="GridView1" style="border:1px solid; height: 40px;">
conteúdo
</div>

I made a div using the same id as grid to illustrate, since here you can not test the grid code, please note that clicking div remains, but content is erased.

    
14.06.2017 / 14:00