Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<asp:TextBox ID="txtHoursorAmount" runat="server" style="width: 80px;"/>
<input type="hidden" name="hdnAmountorHours" id="hdnAmountorHours" runat="server" />
Posted
Comments
Richard C Bishop 10-Apr-14 17:13pm    
Using what technology? JavaScript? server-side code?
Member 10740414 10-Apr-14 18:56pm    
server-side code but can you mention it in both ways. Just want to learn. Thanks

Hi
This is how you can use Javascript to solve the problem.

XML
<asp:TextBox ID="txtHoursorAmount" runat="server"  onblur="transferValue()"/>
            <input type="hidden" name="hdnAmountorHours" id="hdnAmountorHours" runat="server" />


script is

XML
<script type="text/javascript">
        function transferValue()
        {
            var inputVal = document.getElementById("txtHoursorAmount").value;
            document.getElementById("hdnAmountorHours").value=inputVal;
            alert(inputVal);
        }
    </script>

Good Luck
 
Share this answer
 
in the above solution


change
var inputVal = document.getElementById("txtHoursorAmount").value;

To
C#
var inputVal = document.getElementById('<%=txtHoursorAmount.ClientID %>').value ;


and set value as same as above.......
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900