Subscribe to Subscribers

Forums » .NET » ASP.NET »

Message box not working


Posted Date: 06 Jul 2012      Posted By:: sarthi     Member Level: Silver    Member Rank: 1832     Points: 2   Responses: 3



Hi everyone.. in one aspx page i have used messagebox class.. but the control is not going for display of message.. but i getting desired output on to gridview on click of a button.. before that i want to display that message.. wat might be the problem.. please help..



Responses

#679261    Author: sudhajosyula      Member Level: Gold      Member Rank: 46     Date: 06/Jul/2012   Rating: 2 out of 52 out of 5     Points: 3

Hi Sarthi,
In web application,we don't have predefined MessageBox method.If it is windows application,we have a predefined MessageBox.If you are using third party control,might be it is possible to create a messagebox in web application.Could you explain us the error and the code you have written in your application here,so that we can find a solution.


 
#679263    Author: sarthi      Member Level: Silver      Member Rank: 1832     Date: 07/Jul/2012   Rating: 2 out of 52 out of 5     Points: 1

protected void btnAddStudentAccount_Click(object sender, EventArgs e)
{

MessageBox m1 = new MessageBox();



string StudentName = TextBox1.Text;
string CourseName = TextBox2.Text;
string RegNo = TextBox3.Text;
string RegDate = TextBox4.Text;
string Amount = TextBox5.Text;
string Status = TextBox6.Text;


gits g = new gits();
g.addstudentaccount(StudentName, CourseName, RegNo, RegDate, Amount, Status);

m1.Show("Student Record Added Successfuly");

Response.Redirect("ManageStudentAccount.aspx");
}
in this code control is going managestudentpage with required result..i hav messagebox class in appcode but line m1.Show is not working.. this is the problem..

public void addstudentaccount(string StudentName, string CourseName, string RegNo, string RegDate, string Amount, string Status)
{
SqlConnection con = new SqlConnection(str);
SqlCommand cmd=new SqlCommand("sp_addstudentaccount",con);
cmd.CommandType=CommandType.StoredProcedure;
con.Open();
cmd.Parameters.AddWithValue("@StudentName",StudentName);
cmd.Parameters.AddWithValue("@CourseName",CourseName);
cmd.Parameters.AddWithValue("@RegNo",RegNo);
cmd.Parameters.AddWithValue("@RegDate",RegDate);
cmd.Parameters.AddWithValue("@Amount",Amount);
cmd.Parameters.AddWithValue("@Status",Status);
cmd.ExecuteNonQuery();
con.Close();
}


 
#679351    Author: Paritosh Mohapatra      Member Level: Gold      Member Rank: 6     Date: 08/Jul/2012   Rating: 2 out of 52 out of 5     Points: 2

You may use:


ScriptManager.RegisterStartupScript(Page, GetType(), "MyScript", "alert('Student Record Added Successfuly');", true);


instead of:


m1.Show("Student Record Added Successfuly");



Thanks & Regards
Paritosh Mohapatra
Microsoft MVP (ASP.Net/IIS)
DotNetSpider MVM





 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Autocomplete Extender
Previous : Get data to C# class from sql select command (urgent)
Return to Discussion Forum
Post New Message
Category:

Related Messages

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2013 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.