Passing data from a gridview (from asp.net) to textbox (asp.net) from a modal window boostrap

0

my problem is that I can not find the way to pass the data I have in a gridview to a textbox that I have inside a modal window of boostrap, I think my problem is that somehow if I can send the data to textbox by means of a button but this same button can not open the modal window since it is an object of type asp: CommandField and in this I can not put the data-target that is the property that is needed to be able to open the modal window.

this is the asp code of the object with which I send the value to the textbox

  <Columns>
       <asp:TemplateField HeaderText="Bitacora">
            <ItemTemplate>
                <!-- Este es el botón con el que abro mi ventana modal -->
                <button type='button' class="btn btn-info" data-toggle="modal" data-target="#ModalMiniborar">
                <span class="glyphicon glyphicon-plus" >
                </span> 
            prueba</button>
            </ItemTemplate>
    </asp:TemplateField>
    <asp:CommandField ShowSelectButton="True" /> <!-- Este es el objeto con el que mando el dato a mi textbox -->
   </Columns>

What I want to know if there is any way to send the data and open the modal window at the same time.

    
asked by eddyWong 17.11.2016 в 20:33
source

1 answer

-1

Maybe it's easier than you try to do. Through javascript you can get it.

A Bootstrap modal is nothing more than a <div/> html element with some styles to highlight it over the other html elements of the page.

An asp.net gridView renders a html table <table/> . Simply by opening the modal you can link some javascript event, read the value of the html cell and set it in the textbox of your modal (which is rendered as a <input/> html element).

All those elements belong to the same DOM and you can access them without problems.

    
answered by 28.11.2016 в 18:34