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 HussainRank #423 · 5.9K reputationPosted Aug 20, 2013, 10:53 PM EDT
HttpContext.Current.Response.Write("");
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 20, 2013, 10:18 PM EDT
You can use javascript alert(). But before that I like to know when you want to display the message
Regards,
Iftikar
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 20, 2013, 10:19 PM EDT
you can try like this. where you want messagebox then write this line in .cs
Response.Write("");
Bineesh ViswanathRank #1,681 · 907 reputationPosted Aug 20, 2013, 10:30 PM EDT
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);
}
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 20, 2013, 10:34 PM EDT
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 ViswanathRank #1,681 · 907 reputationPosted Aug 20, 2013, 10:46 PM EDT
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.
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 20, 2013, 10:51 PM EDT
its Response.Write not Response.Redirect.
write this line where you want to show the massage
Response.Write("");