2

I would like to place a button on my page that allows redirect to a custom processing page but the button must be the pencil icon such as when using AllowEdit="True" on a control.

I have the following asp.net :

<px:PXButton runat="server" ID="PXButton1" ImageKey="EditH" ImageSet="control" AlreadyLocalized="True"></px:PXButton>

Which gives the result as can be seen to the left on the image below :

enter image description here

Unfortuantly the button appears a dark grey whereas I need it to mimic the UI of the pencil icon on the right hand side of the image provided.

How would one go about accomplishing this?

Joshua Van Hoesen
  • 1,684
  • 15
  • 30

3 Answers3

4

Try the following definition:

<px:PXButton runat="server" ID="PXbtnValidateAddresses" ImageKey="EditH" ImageSet="control" AlreadyLocalized="True" CommandName="ValidateAddresses" Style="min-width:20px; width:20px; border-style: none;padding-left:0px;padding-right:0px;height:20px;padding-top:0px;background-color:Transparent;"></px:PXButton>

This is the result: enter image description here

Fernando
  • 433
  • 3
  • 9
  • When I add an autocallback to the button so I can trigger an action declared in my graph the pencil graphic disappears. <%-- --%> If I remove CommandName from the button declaration I get the same behavior. – Joshua Van Hoesen Feb 24 '20 at 21:48
  • 1
    In the PXAction declaration, try to set the display name with a blank space: [PXUIField(DisplayName = " ")] – Fernando Feb 24 '20 at 23:14
0

Also possible with the PXButton DAC attribute properties:

[PXButton(ImageKey = Sprite.Main.RecordEdit, Tooltip = ActionsMessages.Edit, CommitChanges = true)]
Hugues Beauséjour
  • 8,067
  • 1
  • 9
  • 22
  • When I implement the code as described above my button just appears as a normal button with it's UI text set as the actions deceleration. – Joshua Van Hoesen Feb 24 '20 at 20:27
  • 1
    Yes on second thought, I should have made my answer a comment because you were looking to change the default style. I upvoted Fernando's answer which has that style change. You can define pencil icon both ways but style is set in ASPX. – Hugues Beauséjour Feb 24 '20 at 21:06
0

You can try to use the <LinkCommand> subtag of the <PXTextEdit> tag. For example:

<px:PXTextEdit ID="fieldID" runat="server" DataField="FieldName" Enabled="False" AllowEdit="True">
    <LinkCommand Target="ds" Command="RedirectAction"/>
</px:PXTextEdit>

You can implement any custom redirect code in the RedirectAction action.

This solution is most generic in your case because it does not depend on specific icons and colors that can change at any time.