This is a migrated thread and some comments may be shown as answers.

[Solved] RibbonBar AccessKey

1 Answer 77 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Milosz
Top achievements
Rank 1
Milosz asked on 05 Oct 2009, 09:01 AM
Hi,
I know that RibbonBar by Russell Mason is not your product bu i don't know where to go and maybe you have tested this functionality, here is the problem: when I set AccessKey of LargeRibbonBar it just doesn't work :), i do the same thing with tabs and asp.net buttons and its working fine, do you have any idea what can i do wrong?

1 Answer, 1 is accepted

Sort by
0
Milosz
Top achievements
Rank 1
answered on 13 Oct 2009, 07:33 AM
i found only one way out,
in RibbonButton class of Russell Mason library i changed this method adding this two lines of code

this.Attributes.Add("onfocus", "this.click();");

 

this.Attributes.Add("tabindex", "-1");

disadvantage of this solution is that the tab index is off because of invoking click event whe focus event is fired

 

protected virtual void RenderClientPostBack()  

{

 

string postBackReference = string.Empty;

 

string clientCode = string.Empty;

 

 

 


if
(this.AutoPostBack)

 

{

 

PostBackOptions options = new PostBackOptions(this);

 

options.AutoPostBack =

true;

 

options.Argument =

this.ID;

 

  

 

if ((this.CausesValidation) && (this.Page.GetValidators(this.ValidationGroup).Count > 0))

 {

options.PerformValidation =

true;

 

 options.ValidationGroup =

this.ValidationGroup;

 

 }

postBackReference =

this.Page.ClientScript.GetPostBackEventReference(options);

 

 }

 

 

if (!string.IsNullOrEmpty(this.OnClientClick))

 {

clientCode =

this.OnClientClick;

 

 }

 

 

if (!string.IsNullOrEmpty(this.NavigateUrl))

 {

 

string target = this.Target;

 

  

 

if (string.IsNullOrEmpty(target))

 {

target =

"_self";

 

 }

 

 

// Embedded JavaScript

 

 

 

string windowOpenCode = string.Format("window.open('{0}', '{1}');", this.NavigateUrl, target);

 

clientCode += windowOpenCode;

}

 

 

if ((!string.IsNullOrEmpty(clientCode)) || (!string.IsNullOrEmpty(postBackReference)))

 {

 

// Embedded JavaScript - Named dependency

 

 

string code = "if (" + this.ClientMemberName + ".getEnabled()) {" + clientCode + postBackReference + "}";

 

  

 

// Embedded JavaScript

 

this.Attributes.Add("onclick", code);

 

 

this.Attributes.Add("onfocus", "this.click();");

 

 

this.Attributes.Add("tabindex", "-1");

 

 

}

}

 

Tags
General Discussions
Asked by
Milosz
Top achievements
Rank 1
Answers by
Milosz
Top achievements
Rank 1
Share this question
or