Click here to Skip to main content
15,897,718 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hii all,
actually i want to make an alert message with specific data inside it, for example 'product 1 has reached its level'.
i cannot do it so i tried another way to show the alert message but not with specific pid inside it

here is my code
C#
SqlConnection connection = new SqlConnection("Data Source=aaaVAIO;Initial Catalog=System;Integrated Security=True");

        SqlCommand abc = new SqlCommand("select pid, case when (Pamount <= SafetyStock) then 'has reached its limit!' end as Alert from Product ", connection);
       
        try
            {
         
                connection.Open();

            SqlDataReader rdr = abc.ExecuteReader();
                while (rdr.Read())
                {
              
                    ListBox1.Items.Add(rdr["alert"].ToString());
                    foreach (ListItem li in ListBox1.Items)
                    {
                        if (li.Text.Equals("Limit stock has been reached"))
                        {
                           
                            ClientScriptManager def= Page.ClientScript;

                            {
                                string strconfirm = "<script>if(window.confirm('Limit Stock has been reached!')){window.location.href='/Inventory system/Manager/Updateproductdetails.aspx'}</script>";
                                def.RegisterClientScriptBlock(this.GetType(), "Confirm", strconfirm, false);
                            }
                       
                        }
                    }
                }
                rdr.Close();


At code above, i store the sqlcommand output in list box then the alert message will show the alert message based on the list content. If there is limit stock has been reached message in the listbox then the alert message will come out.

Actually i want to make it more specific where it shows the specific pid that reached its limit. for example, the alert message will show message 'Product 1 has reached its limit'.
please suggest me solution for this problem.
should i store the value in gridview first? or any other way to do it?
thank you in advanced.
Posted
Updated 25-May-14 18:44pm
v2

XML
Response.Write("<script>");
            

Response.Write("window.open('AssigningMainChemicals.aspx?RECID=" + recid + "','_blank')");
            
Response.Write("</script>");
 
Share this answer
 
Try this,,,:)

C#
string ser="product 1 has reached its level";


ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('Limit Stock has been reached!!!on " + ser + "')", true);
 
Share this answer
 

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