Pooja Chowdhury

Pooja Chowdhury

  • NA
  • 396
  • 39.2k

add data in textbox

Aug 2 2017 1:53 AM
 i  have one textbox  and one button
 
<asp:TextBox ID="txtPrevPol" runat="server" Placeholder="Policy No" class="form-control" ValidationGroup="P" />
 
<asp:Button ID="btnPAdd" runat="server" Text="Add" class="form-control btn btn-primary" ValidationGroup="P" />
 
 
i put value first in this textbox (ex: 1234)
 
it added and show in another textbox
 
<asp:TextBox ID="txtPrevPolList" runat="server"  TextMode="MultiLine" ReadOnly="true" ></asp:TextBox>
 
output like that:
 
(ex:
1. 1234)
 
 
again i added the valur in the textbox ( txtPrevPol)( ex :3456)
 
 
show it in the txtPrevPolList
output:
 
(ex:
1. 1234
2. 3456 ) 
 
i am doing this using the following script:
 
<script>
var cnf = $.noConflict();
var count = 1;
cnf('#<%=btnPAdd.ClientID%>').click(function () {
var txt = cnf('#<%=txtPrevPol.ClientID%>').val();
if (txt != '') {
cnf('#<%=txtPrevPolList.ClientID%>').append((count++) + ':' + txt + '\n');
cnf('#<%=txtPrevPol.ClientID%>').val('');
return false;
}

});
 
 
when i fetch  all values from the textbox (
txtPrevPolList
(ex:
1. 1234
2. 3456 ) )
 
  to save it into the database
 
 
 i cannot get the values from the textbox 
 

Answers (3)