<head>
function chk()
{
  var x=document.getElementByID("txtmax");
  
}
</head>
<body>
<form runat="server" id="form1">
MaxValue:<asp:textbox id="txtboxmax" runat="server" />
<asp:gridview id="gr" runat="server" >
  <columns>
      <asp:templatecolumn>
        <asp:textbox id="txtboxmin" runat="server" />
        <asp:CustomValidator ID="cv" runat="server" EnableClientScript="true" ControlToValidate="txtmin" ClientValidationFunction="Chk()" ErrorMessage="*" />
     </asp:templatecolumn">
    <asp:boundfield datafield="name"/>
 </column>
</asp:gridview>
</form>
</body>

i want compare the value of txtmax in the GridView with the txtmin through javascript.if txtmax value is greater than txtmin value.then custom error (*) should displayed.above is my code.the problem how can i pass my txtmax value to chk() function.Pls help.

hi,
hope this helps

function chk(txtmin)
{
var tmax=document.getelementbyid('txtmax');
if(txtmin.value>tmax.value)
{
   alert('min value');


}
}
in the design of datgrid  for template field containing txtmin change the function with chk(this);