Hi.,
Need to do validation in javascript / codebehind (vb.net)
onfocus of Amount textbox i have to make alert as "select Product" if Product dropdown is not selected with any value
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Blocked AccountPosted Dec 26, 2011, 7:15 AM
you can do this like that
<script type="text/javascript">
function check() {
if ((document.getElementById("DropDownValue").selectedIndex)== 0) {
alert("Please select the Name!");
return false;
}}
script>
<asp:DropDownList ID="DropDownValue" runat="server">
<asp:ListItem Text="Manish" Value="Manish">asp:ListItem>
<asp:ListItem Text="Gaurav" Value="Gaurav">asp:ListItem>
<asp:ListItem Text="Ravi" Value="Ravi">asp:ListItem>
asp:DropDownList>
<asp:TextBox onfocus="Javascript:check();" ID="TextBoxAlert"
runat="server">asp:TextBox>
i think you will get some idea from this solution.