Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How I get the value of textBox which is in Template field ?

XML
<asp:TemplateField HeaderText="Weightage">
  <ItemTemplate>
    <asp:TextBox ID="txtWtg" runat="server" height="20px" Width="43px">
    </asp:TextBox>
  </ItemTemplate>
</asp:TemplateField>


function checkKRA()
{
  if (document.getElementById(txtWtg).value == '';)
  {
    alert('The KRA can not empty');
    return false;
  }
}


But I can't read the value of textBox.

Kindly appreciate your help ?
Posted
Updated 26-Nov-10 1:44am
v2
Comments
JF2015 26-Nov-10 7:44am    
Edited to improve code formatting.

1 solution

It's a template field inside datagrid/gridview so it will generate irregular IDs so try this.

Get textbox value in a multiple item gridview templatefield using javascript[^]
 
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