ASP.NET Add Double Click to ListBox

You have an ASP.NET ListBox and you want to be able to allow users to Double Click on the list box to select items.  You can add a hidden button to your page and then add a double click event to the list box to select items as shown below.

//Setup a string that will call a hidden button click event
string BntListBoxClick =  "document.getElementById('" 
                               + BtnAddToTarget.ClientID.ToString() + "')" 
                               + ".click();";

//Add the double click event to the list box
LBoxSelectItems.Attributes.Add("OnDblClick", BntListBoxClick);

ASP.NET Call Command Button from Javascript/HTML

In ASP.NET you need to call a button click event event from another control, or to take some type of action in the code behind.

The example below adds a double click event to an ASP.NET ListBox and calls a ASP.NET command button.

//Setup a string that will call a button click event
string BntListBoxClick =  "document.getElementById('" 
                              + BtnAddToTarget.ClientID.ToString() + "')" 
                              + ".click();";

//Add the double click event to the list box
LBoxSelectItems.Attributes.Add("OnDblClick", BntListBoxClick);


ASP.NET CreateUserWizard Override SendingMail Event

Recently I had an issue where I needed to call another email method and not use the STMP settings in the Wizard Control. 

I send an email to have the user verify their account using the CreateUserWizard SendingEmail Event. This works great by using the email setup in the control.



In order to override the send email event I issued a return statement in the SendingMail event handler.

protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
{
return; . . .

Next I created an event after the user was created using oncreateduser="CreateUserWizard1_CreatedUser"

Now in the CreateUserWizard1_CreatedUser method I send the registration email to the new user.

 protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
OverideWizardEmail();
}  

private void OverideWizardEmail()
{ 
MembershipUser UserInfo = Membership.GetUser(CreateUserWizard1.UserName);
string VerifyURL = string.Empty;
..... send email