index.aspx page code
index.aspx.cs page code
public partial class WebForm1 : System.Web.UI.Page
{
{
/*Some code here*/
public void HidePopup()
{mp1.Hide();
}
}
I have another page where i write code of popup
Popup.aspx page code
protected void btnSubmit_Click(object sender, EventArgs e)
{
string con = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
try
{
if (Page.IsValid)
{
using (SqlConnection connection = new SqlConnection())
{
connection.ConnectionString = con;
SqlCommand cmd = new SqlCommand();
cmd.Connection = connection;
cmd.CommandText = "spInsertEnquiry";
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@fname", TextBoxFullName.Text);
cmd.Parameters.AddWithValue("@email", TextBoxEmail.Text);
cmd.Parameters.AddWithValue("@state", TextBoxState.Text);
cmd.Parameters.AddWithValue("@city", TextBoxCity.Text);
cmd.Parameters.AddWithValue("@mobilephone", TextBoxMobile.Text);
connection.Open();
cmd.ExecuteNonQuery();
}
}
}
catch
{
}
WebForm1 ob = new WebForm1();
ob.HidePopup();
}
{
string con = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
try
{
if (Page.IsValid)
{
using (SqlConnection connection = new SqlConnection())
{
connection.ConnectionString = con;
SqlCommand cmd = new SqlCommand();
cmd.Connection = connection;
cmd.CommandText = "spInsertEnquiry";
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@fname", TextBoxFullName.Text);
cmd.Parameters.AddWithValue("@email", TextBoxEmail.Text);
cmd.Parameters.AddWithValue("@state", TextBoxState.Text);
cmd.Parameters.AddWithValue("@city", TextBoxCity.Text);
cmd.Parameters.AddWithValue("@mobilephone", TextBoxMobile.Text);
connection.Open();
cmd.ExecuteNonQuery();
}
}
}
catch
{
}
WebForm1 ob = new WebForm1();
ob.HidePopup();
}
Error : object reference not set to an instance
Sunny JaiswalPosted Feb 12, 2015, 8:31 PM
Khargesh RajputPosted Feb 11, 2015, 10:46 PM
Sunny JaiswalPosted Feb 11, 2015, 10:49 AM
Khargesh RajputPosted Feb 10, 2015, 10:58 PM
after saving data
use
on popup.aspx.cs
ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "RefreshParent", "", false);
and this RefreshParent() is javascript function
popup.aspx
this may help you