1

I am not able copy or automatically bind into the second textbox. Which event do i need to handle, onkeyup or onblur?

This is my code:

<script type="text/javascript">    
    function OneTextToother()   
    { 
    var first=document.getElementById(txtQuantity).value;    
    document.getElementById(txtQuantity1).value=first; 
    }     
</script>

<asp:GridView ID="gvOrder" runat="server" OnRowDataBound="gvOrder_RowDataBound">       
<Columns>              
<asp:TemplateField>                   
<ItemTemplate>                    
<asp:TextBox ID="txtQuantity" runat="server" onkeyup="javascript:OneTextToother();" >
</asp:TextBox>                    
</ItemTemplate>                                
</asp:TemplateField>     
<asp:TemplateField>                  
<ItemTemplate>                
 <asp:TextBox ID="txtQuantity1" runat="server" ></asp:TextBox>               
</ItemTemplate>                              
</asp:TemplateField>          
</Columns>        
</asp:GridView>

1 Answer 1

1

You can use Client Id property

<%# ((GridViewRow)Container).FindControl("txtQuantity1").ClientID %>

So

var first = document.getElementById('<%# ((GridViewRow)Container).FindControl("txtQuantity").ClientID %>');

document.getElementById('<%# ((GridViewRow)Container).FindControl("txtQuantity1").ClientID %>').value=first;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.