javascript - Validation disappears on autopostback -
i validating control using javascript function. cannot use validators available in asp. s working fine when radio button postback rest of validation disappear. here validation code
function validateform() { var validate = true; var summary = document.getelementbyid("<%=summary.clientid%>"); if (summary.value == "") { summary.style.backgroundcolor = "yellow"; validate = false; } if (validate == false) { alert('please fill highlighted fields'); } return validate;
here button code validate
<asp:button id="button1" runat="server" onclick="button1_click" text="submit" onclientclick="return validateform();" />
here radio button code
<asp:radiobutton id="submitter" text="submitter" groupname="rd2" runat="server" forecolor="black" oncheckedchanged="submitter_changed" autopostback="true" /> <asp:radiobutton id="following" text="following" groupname="rd2" runat="server" forecolor="black" oncheckedchanged="following_changed" autopostback="true" />
i want color not change after autopostback. me please how it.
try using updatepanel this
<asp:updatepanel id="updatepanel1" runat="server" updatemode="conditional"> <contenttemplate> <asp:radiobutton id="submitter" text="submitter" groupname="rd2" runat="server" forecolor="black" oncheckedchanged="submitter_changed" autopostback="true" /> <asp:radiobutton id="following" text="following" groupname="rd2" runat="server" forecolor="black" oncheckedchanged="following_changed" autopostback="true" /> </contenttemplate> </asp:updatepanel>
Comments
Post a Comment