Home All Groups Group Topic Archive Search About
Author
2 Jun 2006 2:59 PM
ODAN
I have an ASP.NET application written in C#. one of the web form where you
create user information and user name has a button to click to print
selected user information for the users record. However when this button is
clicked it does nothing the first time, bring up the popup the second time
it is clicked. We need this button to bring up the popup with the
information the first time it is clicked. Any ideas will be greatly
appreciated. The code in the btn_click event is listed below.


private void btnPrint_Click(object sender, System.EventArgs e)

{

string securityQuestion=ddlQuestion.SelectedItem.Text;

securityQuestion=securityQuestion.Replace("'","\\'");

lblName.Text=txtUserName.Text;

lblPswd.Text=txtPassword.Text;

lblSecQuestion.Text= securityQuestion;

lblAns.Text=txtAnswer.Text;

btnPrint.Attributes.Add("OnClick","return
PrintDocument('"+divusername.ClientID+"');");

}



Thanks!

Author
2 Jun 2006 8:24 PM
Kevin Spencer
Not sure what you mean by "bring up the popup" but it looks like you're
handling a Click event by adding a client-side click event handler. That
would cause the client-side click event handler to fire only after the
button was clicked a second time.

Instead, if the function being called should be run immediately, just add a
JavaScript to the page that calls the function.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Development Numbskull

Nyuck nyuck nyuck


Show quoteHide quote
"ODAN" <olu***@hotmail.com> wrote in message
news:%238AUoVlhGHA.1508@TK2MSFTNGP04.phx.gbl...
>I have an ASP.NET application written in C#. one of the web form where you
>create user information and user name has a button to click to print
>selected user information for the users record. However when this button is
>clicked it does nothing the first time, bring up the popup the second time
>it is clicked. We need this button to bring up the popup with the
>information the first time it is clicked. Any ideas will be greatly
>appreciated. The code in the btn_click event is listed below.
>
>
> private void btnPrint_Click(object sender, System.EventArgs e)
>
> {
>
> string securityQuestion=ddlQuestion.SelectedItem.Text;
>
> securityQuestion=securityQuestion.Replace("'","\\'");
>
> lblName.Text=txtUserName.Text;
>
> lblPswd.Text=txtPassword.Text;
>
> lblSecQuestion.Text= securityQuestion;
>
> lblAns.Text=txtAnswer.Text;
>
> btnPrint.Attributes.Add("OnClick","return
> PrintDocument('"+divusername.ClientID+"');");
>
> }
>
>
>
> Thanks!
>
>
>
>