TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ramya S
NA
79
8k
onclientclick event
Jun 24 2016 3:24 AM
Hi,
here is my aspx code:
<div align="center" style="display:table;margin:auto"><asp:TextBox runat="server" ID="txtSearch" CssClass="search" placeholder="Enter Stock Number(or) Stock Description.." style="margin-left: 0" Width="367px" ForeColor="#00" ></asp:TextBox>
<asp:Button runat="server" ID="btnSearch" Text="Search" OnClick="btnSearch_Click" OnClientClick="displayalert()" ForeColor="#003c71"/></div>
</div>
itemtemplate in grid view:
<asp:TextBox runat="server" ID="txtQnty" Text='<%#Eval("Quantity") %>' ForeColor="#003c71"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Update">
<ItemTemplate>
<asp:Button runat="server" ID="btnUpdate" Text="Update" OnClientClick="updatealert()" OnClick="btnUpdate_Click" ForeColor="#003c71"></asp:Button>
</ItemTemplate>
</asp:TemplateField>
my javascript code is:
<script type="text/javascript">
function displayalert()
{
if(document.getElementById("txtSearch").value == "")
{
alert("Enter stock number or stock description!");
return false;
}
}
</script>
<script type="text/javascript">
function updatealert()
{
if (document.getElementById("txtQnty").value == "") {
alert("Enter Quantity!");
return false;
}
else {
alert("Update Successfully!")
return true;
}
}
</script>
<script type="text/javascript">
why OnClientClick="updatealert()" is not working and
displayalert() showing alert message but redirecting to error message!
Reply
Answers (
3
)
Menu is not displaying properly.
What is difference between Dynamic xpath and Relative xpath?