0
I have some DIV that open a modal, but I would like that when clicked, 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 selection of gridview. Ex: I click to select a line, when clicking on the linkmodal, leave no lines 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>
I did it this way that informed Leandro, but it doesn’t work. I just changed the textbox by txtid that is the ID in my textbox.
– Mariana
@marianac_costa Try again, I edited the post putting exactly the informed id. Remembering that you have to put the script call (jquery.min.js) inside the page’s head tag.
– Leandro
It worked right Leandro, thanks. You know how I do to clear grid selection in function? Wanted along with this. Thanks.
– Mariana
@marianac_costa Edit the main post and post the code snippet of the grid so I can see how the grid in question is doing and edit the answer with the function to clear the grid as well.
– Leandro
I edited .. the way I’m doing, it disappears the grid, I’d like you to just clear the selection. Thanks.
– Mariana
@marianac_costa I edited the post by placing a script to clean the content without removing the grid, I did it with a div to illustrate the behavior of the script.
– Leandro
This way he is removing the Grid.
– Mariana
Let’s go continue this discussion in chat.
– Leandro