0
<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.

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by greeny_1984
0

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);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.