Sir, could you tell me a solution for a MessageBox like function in ASP.NET.
I know to handle this function with Label Control. So not need this.
I want a function same as Messagebox.
The function is not a first calling form database, calling from SPclass into .aspx.cs class.
So the function to invoke MessageBox to be write in SP class.
if you had any doubt on my question, ask .Otherwise, give solution.
Loading

Iftikar HussainPosted Aug 21, 2013, 2:53 AM
HttpContext.Current.Response.Write("");
Sanjeeb LenkaPosted Aug 21, 2013, 2:51 AM
its Response.Write not Response.Redirect.
write this line where you want to show the massage
Response.Write("");
Bineesh ViswanathPosted Aug 21, 2013, 2:46 AM
But showing error that Response does not exists..........
Can this problem solve by adding java script namespace?, then give the namespace class for
contain the Response.Redirect.
Iftikar HussainPosted Aug 21, 2013, 2:34 AM
if (incount > 0)
{
Response.Write("");
}
but this is not an good idea to show.
You can use Label control to display the message
if (incount > 0)
{
Label1.Text="Saved Successfully";
}
Bineesh ViswanathPosted Aug 21, 2013, 2:30 AM
public void classAdd(classInfo infoClass)
{
try
{
if (sqlCon.State == ConnectionState.Closed)
{
sqlCon.Open();
}
SqlCommand c = new SqlCommand("classAdd", sqlCon);
c.CommandType = CommandType.StoredProcedure;
c.Parameters.Add("@className", SqlDbType.VarChar).Value = infoClass.className;
c.Parameters.Add("@noOfseats", SqlDbType.Int).Value = infoClass.noOfseats;
int incount = c.ExecuteNonQuery();
if (incount > 0)
{
//The MessageBox to be show here.
//Message is: "Saved Successfully","SCHOOLERP",MessageBoxIcon.Information,MessageBoxButton.Ok);
}
}
catch (Exception)
{
throw;
}
finally
{
sqlCon.Close();
}
.aspx.cs code:-
protected void btnSave_Click(object sender, EventArgs e)
{
classInfo infoclass = new classInfo();
classSP spClass = new classSP();
infoclass.className = txtClassName.Text;
infoclass.noOfseats = int.Parse(txtnoOfSeats.Text);
spClass.classAdd(infoclass);
}
Sanjeeb LenkaPosted Aug 21, 2013, 2:19 AM
you can try like this. where you want messagebox then write this line in .cs
Response.Write("");
Iftikar HussainPosted Aug 21, 2013, 2:18 AM
You can use javascript alert(). But before that I like to know when you want to display the message
Regards,
Iftikar