|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
button click event problemcreate 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! 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. -- Show quoteHide quoteHTH, Kevin Spencer Microsoft MVP Professional Development Numbskull Nyuck nyuck nyuck "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! > > > >
DropDownList problem
add default row to DropDownList change web.config programmatically Hyperlink control NavigationUrl problem Gridview and Filtering problem Need to keep source window open after Hyperlink is activated menu control will not expand (2.0) how to execute the DeleteCommand in code-behind? drop down list Threading in ASP.NET 2.0 web parts |
|||||||||||||||||||||||