Click here to Skip to main content
16,018,653 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi, i had two textboxes if in both texboxes values are inserted then it should display a popup window as your data inserted succesfully if any one of the textbox is empty then it should display a pop window as data not inserted successfully.......plz help me anyone
Posted
Comments
[no name] 24-Jun-13 7:29am    
Post the code that you have tried and then explain what the problem is that you are experiencing with your code.
gatturamesh 24-Jun-13 7:34am    
can u tell me how to display a popup window withour using ajax controls or validations in java script

1 solution

Hi,

you don't want to use AJAX, that is fine, but you don't want to use Javascript also ? I think you have go for javascript in order to show the notification alert message. but this message you can show from code behind also. check out below how:
C#
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Notify", "alert('Data Inserted Successfully');", true);


you can change the message text however you need based on the conditions.

refer ScriptManager.RegisterStartupScript Method (Page, Type, String, String, Boolean)[^] for more.

hope it helps.
 
Share this answer
 
Comments
gatturamesh 24-Jun-13 7:54am    
hi here it is the code i had written in button click code


protected void Button1_Click(object sender, EventArgs e)
{

try
{

string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
FileUpload1.SaveAs(Server.MapPath("~/admin/images1/" + filename));
cn.Open();
SqlCommand cmd = new SqlCommand("animation_page", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@FileName", TextBox1.Text);
cmd.Parameters.AddWithValue("@FilePath", "~/admin/images1/" + filename);
int i = cmd.ExecuteNonQuery();
cn.Close();

if (i == 1)
{

Response.Write("<script type=\"text/javascript\">alert('image inserted succesfully');</script>");
TextBox1.Text = "";


}
else
{

Response.Write("<script type=\"text/javascript\">alert('image not inserted succesfully');</script>");
}
}

catch (SqlException ex)
{

throw ex;

}
}
when i am entering both values it is showing a popup box but when i left upload file field then it is not showing the else part

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