Modal Popup Extender, AJAX Tool Kit, Validation Controls ASP.NET





I am using Modal popup Extender in my project which after click save button appears and takes Reason for doing that action as an input. I am using a text box labelling Reason for change; if that box is empty I am telling my transaction to roll back. So to make changes appear in database user has to fill the reason. I wanted to validate that using required validation control of Asp.net but it was firing the validation on parent page so it was not showing me modal popup. Then I used JavaScript to validate that box and it worked. I am using JavaScript behind my modal popup panel OK button which checks if reason to change is empty then show warning and do not proceed until unless user provides the reason for change.

<script type=”text/javascript”>

function ValidateReason()

{

if(document.getElementById(‘<%=txtChangeReason.ClientID%>’).value==“”)

{

alert(“Please enter reason for change!”);

window.event.returnValue = false;

return false;

}

return true;

}

</script>

window.event.returnValue = false; this line cancels all event without this line modal popup was hiding itself without validation. Please leave your comments or anyother way around.




Tags: , , , , , ,

11 Responses to “Modal Popup Extender, AJAX Tool Kit, Validation Controls ASP.NET”

  1. Hello, I can’t understand how to add your blog ( http://www.isolutionteam.co.uk ) in my rss reader

  2. bescestibra says:

    http://www.isolutionteam.co.uk – great domain name for blog like this)))
    ————————
    sponsor: http://hyundai-hyundai-accent.ru

  3. nonyendurdy says:

    http://www.isolutionteam.co.uk – now in my rss reader)))
    ————————
    sponsored link: http://lilid.ru/

  4. Elesseffilt says:

    http://www.isolutionteam.co.uk – great domain name for blog like this)))
    ————————
    ad: http://zehon.ru/

  5. Spoutoums says:

    http://www.isolutionteam.co.uk – great domain name for blog like this)))
    ————————
    signature: http://vahar.ru/

  6. NeapOuppy says:

    http://www.isolutionteam.co.uk – great domain name for blog like this)))
    ————————
    my blog: http://cexiq.ru/

  7. Ajinkya says:

    Hi friend,
    this code is not working in my web application, if you have any other solution plz tell me.
    thanks!

  8. Piyush Chandra says:

    This is best one article so far I have read online. I would like to appreciate you for making it very simple and easy. I have found another nice post related to this post over the internet which also explained very well. For more details you may check it by visiting this url…

    Thanks

Leave a Reply