Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hii,
how can i make automatic pop up alert message when i open a particular page?
the alert message is used to identify the products that reached its stock limit by comparing both columns in sql server.
it is like when the user update the amount of product in product page and the amount is equal or less than the stock limit then after the user refresh the page then the alert message will be come out automatically. for example, the stock limit is 100, then user update product amount to 90 then after refreshing the page the alert message will come out.

please give me solution for this problem. thank you
Posted
Comments
Tejas Vaishnav 12-May-14 9:39am    
you can write your checking code in your page load event and according to your condition, you can show alert messages to user, so this code every time execute when you reload your page.
hahaahahaahahhahahahhahaha 12-May-14 10:03am    
could you give me an example code for it?? im new in this area, so i dont understand much about it @@
hahaahahaahahhahahahhahaha 12-May-14 20:40pm    
what is checking code means?

1 solution

Try this:

JavaScript
<script language="javascript" type="text/javascript">
function IsValidStockValue()
{
var uid;
var temp=document.getElementById("<%=txtValue.ClientID %>");
uid=temp.value;
if(uid > "Stock limit value")
{
alert ("Please Enter Actual Stock Value.");
return false;
}
else
{
return true;
}
}
</script>
 
Share this answer
 
Comments
hahaahahaahahhahahahhahaha 12-May-14 10:05am    
@kaushal15 how can i identify the product amount that already reach its limit? cause i should get the data from database.
KaushalJB 13-May-14 1:00am    
You need to call a web method in javascript that would check your value...
Check this link for more and the method in cs page u can call your value from database

http://www.itorian.com/2012/07/calling-aspnet-c-method-web-method.html
hahaahahaahahhahahahhahaha 13-May-14 4:33am    
my system is actually should show the alert message without any input from users. it will identify the sqlcommand and work based on it.
actually i try to create my own but not working. could u help me.
here is my code:
my c# code:
if (Page.IsPostBack)
{
SqlConnection connection = new SqlConnection("Data Source=MELINA_YEO-VAIO;Initial Catalog=InventorySystem;Integrated Security=True");
connection.Open();
SqlCommand abc = new SqlCommand("Select case when (P_Amount <= SafetyStockamount) then 'Limit stock has been reached' end as Alert from Product");
Page.RegisterStartupScript("ScriptDescription", "<script type=\"text/javascript\"> alert('Limit stock has been reached');</script>");
}

my javascript code:
<script
type="text/javascript"> alert('Limit stock has been reached!');
</script>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900