Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Setting the Default Button - ASP.Net

RSS
Modified on Wed, Oct 22, 2008, 3:38 PM by Administrator Categorized as ASP·NET Web Forms

Simple Save Button

if (mainForm != null)
    mainForm.DefaultButton = uxSaveButton.UniqueID;

Login Control

HtmlForm mainForm = (HtmlForm)Master.FindControl("form1");

Button defaultButton = (Button)uxLoginControl.FindControl("LoginButton");
if (mainForm != null && defaultButton != null)
    mainForm.DefaultButton = defaultButton.UniqueID;

ChangePassword Control

HtmlForm mainForm = (HtmlForm)Master.FindControl("form1");

if (mainForm != null)
{
	Control c = uxChangePasswordControl.FindControl("ChangePasswordContainerID");

	if (c != null)
	{
		Button defaultButton = (Button)c.FindControl("ChangePasswordPushButton");
		if (defaultButton != null)
			mainForm.DefaultButton = defaultButton.UniqueID;
	}
}

RequestNewAccount Control

HtmlForm mainForm = (HtmlForm)Master.FindControl("form1");

if (mainForm != null)
{
	Control c = uxCreateUserWizard.FindControl("__CustomNav0");

	if (c != null)
	{
		Button defaultButton = (Button)c.FindControl("StepNextButton");
		if (defaultButton != null)
			mainForm.DefaultButton = defaultButton.UniqueID;
	}
}

PasswordRecovery Control

HtmlForm mainForm = (HtmlForm)Master.FindControl("form1");

if (mainForm != null)
{
	Control c = uxPasswordRecovery.FindControl("UserNameContainerID");

	if (c != null)
	{
		Button defaultButton = (Button)c.FindControl("SubmitButton");
		if (defaultButton != null)
			mainForm.DefaultButton = defaultButton.UniqueID;
	}
}

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.