locked
TextBox Values RRS feed

  • Question

  • User-797751191 posted

    Hi

      I have 2 textboxes txtname & Txtadress & i want when user update the textboxes , their values should get update in below line . Client Side / Server Side

    <div >
                        <ul>
                           <li>
                              <span>1.</span>I certify that the above receipts have been received from the bank account of 
                              <b>
                                 <asp:textbox ID="txtName" runat="server" Text=""></asp:textbox>
                              </b>
                              residing at 
                              <b>
                                 <asp:textbox ID="txtAddress" runat="server" Text=""></asp:textbox>
                              </b>
                           </li>
    
                        </ul>
                        </br> </br>
                        
                    </div>
    Thursday, June 20, 2019 2:03 PM

All replies

  • User2103319870 posted

    I have 2 textboxes txtname & Txtadress & i want when user update the textboxes , their values should get update in below line . Client Side / Server Side

    Try below code

    HTML

    </div>
    		<div>
    			<ul>
    				<li>
    					<span>1.</span>I certify that the above receipts have been received from the bank account of 
                              <b>
    							  <input name="txtName" type="text" id="txtName" />
    						  </b>
    					<span id="bankacccountname"></span>
    					residing at <span id="bankaddress"></span>
    					<b>
    						<input name="txtAddress" type="text" id="txtAddress" />
    					</b>
    				</li>
    			</ul>
    			</br> </br>
                        
    		</div>

    Jquery Code

    $(function () {
    			//Attach change event to textbox
    			$('#txtName').change(function () {
    				//change the span tag with value from texbox
    				$("#bankacccountname").text($('#txtName').val());
    			});
    
    			$('#txtAddress').change(function () {
    				$("#bankaddress").text($('#txtAddress').val());
    			});
    		});
    Thursday, June 20, 2019 3:51 PM
  • User-797751191 posted

    Hi A2H

      If with <asp> tag to be done then how it can be done

    Thanks

    Thursday, June 20, 2019 4:48 PM
  • User753101303 posted

    Hi,

    Not sure to get exactly what you want especially as it seems you are talking about both client side and server side values. If you are new to Web Forms and still need to grasp how the web works,  I would suggest to have a look at https://docs.microsoft.com/en-us/aspnet/web-forms/overview/presenting-and-managing-data/model-binding/retrieving-data 

    It shows how you can get data from a db to show that in a web page, and get values back once the user edited those values...

    Thursday, June 20, 2019 4:58 PM
  • User2103319870 posted

    If with <asp> tag to be done then how it can be done

    If you are taking about asp:Textbox, the same code works. I just posted the html to let you know that I added two span tags to display the value typed in textbox. SO you need to update your html like that

    <div>
    			<ul>
    				<li>
    					<span>1.</span>I certify that the above receipts have been received from the bank account of 
                              <b>
    							  <asp:TextBox ID="txtName" runat="server" Text=""></asp:TextBox>
    						  </b>
    					<span id="bankacccountname"></span>
    					residing at <span id="bankaddress"></span>
    					<b>
    						<asp:TextBox ID="txtAddress" runat="server" Text=""></asp:TextBox>
    					</b>
    				</li>
    
    			</ul>
    			</br> </br>
                        
    		</div>

    Thursday, June 20, 2019 7:53 PM