message box

B

bbawa1

I want to show a mwesage box depending on condition in button click
event. But it doesn't show message right away when I click the button
second time only then it shows me mseeagebox but I want to show
message box right away when it goes into else statement.


int count = VerifyDupRecord(str2, (this.lblUserid11.Text));
if (count == 0)
{
objCmd.ExecuteNonQuery();
}
else
{

btnApplication.Attributes.Add("onclick",
"javascript:alert('You already added this Application');");
objConn.Close();
return;
}
//objCmd.ExecuteNonQuery();
objConn.Close();
this.gdAddUser.DataBind();

}
 
B

bruce barker

thats because you added the alert to the click. see:

ClientScript.RegisterStartupScript(this.GetType(),"hello","alert('hi');",true);

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top