Extra Attribute within tag Markup to Codebehind

  1. #1

    Extra Attribute within tag Markup to Codebehind

    Hi Guys,

    Any ideas how to convert the attribute SortData at Markup to Codebehind ? thanks

    MARKUP
    <ext:Button ID="btnFindToolOrderName"
       SortData="={{property:'ds_name',direction:'ASC'}}" />
    
    CODEBEHIND
     new ext.Button() {
          Id = "btnFindToolOrderName"
          sortData ?????
      }
  2. #2
    Hi @luizhp,

    If you define a non-existing property (there is no the SortData property in the Button class) in markup, it is treated as a shorthand for CustomConfig.

    In code behind you should create a ConfigItem and put it to a Button's CustomConfig.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @luizhp,

    If you define a non-existing property (there is no the SortData property in the Button class) in markup, it is treated as a shorthand for CustomConfig.

    In code behind you should create a ConfigItem and put it to a Button's CustomConfig.
    Thanks for the explanation!!! But in markup, using non-properties, keeps you showing in Visual Studio: "Attribute 'SortData' is not a valid attribute of element 'Button'." It's pretty annoying. So in this moment, I'll continue using the markup but changing with this:

    <ext:Button ID="btnFindToolOrderName" runat="server">
       <CustomConfig>
           <ext:ConfigItem Name="SortData" Value="={{property:'id',direction:'ASC'}}"
               Mode="Raw">
           </ext:ConfigItem>
       </CustomConfig>
    </ext:Button>
  4. #4
    I don't have such a warning in VS 2012. Though, it might actually happen in previous versions.

Similar Threads

  1. Replies: 6
    Last Post: Apr 30, 2010, 2:57 PM
  2. C# Code in Markup-Script-Tag or Codebehind
    By macap in forum Open Discussions
    Replies: 5
    Last Post: Apr 07, 2010, 3:58 AM
  3. Why use Markup instead of Codebehind?
    By dbassett74 in forum 1.x Help
    Replies: 1
    Last Post: Apr 21, 2009, 7:51 PM
  4. Replies: 3
    Last Post: Apr 21, 2009, 6:19 PM
  5. Prb: Moving objects from codebehind til markup
    By plykkegaard in forum 1.x Help
    Replies: 1
    Last Post: Mar 22, 2009, 2:16 PM

Posting Permissions