Adding dynamically generated config property and controls to window

  1. #1

    Adding dynamically generated config property and controls to window

    Hi,

    I am getting my config as a json string at server side along with items(controls) which i want to apply to the window.

    The below code works fine:
    Ext.onReady(function () {
                   var config = {
                       title: "Creating new tender - General description - Step 1/6",
                       id: 'Window1',
                       width: 700,
                       height: 500,
                       renderTo: Ext.getBody(),
                       maximizable: true,
                       minimizable: true,
                       layout: 'fit',
                       resizable: true,
                       autoLoad: true,
                       items: [{
                        xtype: 'form',
                        title: 'Form1'
                        }]
                   };
    
                   var w = new Ext.Window(config);
                   w.show();
                   w.center();
               });
    but the below code is not working as the Window.Config and Window constructor both doesn't accept string config parameter and i have to implement it on server side:

    string config = @" {title: 'Creating new tender - General description - Step 1/6',
                                 id: 'Window1',
                       width: 700,
                       height: 500,
                       renderTo: Ext.getBody(),
                       maximizable: true,
                       minimizable: true,
                       layout: 'anchor',
                       resizable: true,
                       autoLoad: false,
                       fieldDefaults: {
                           msgTarget: 'side',
                           labelWidth: 75
                       },
                       defaultType: 'textfield',
                       defaults: {
                           anchor: '100%'
                       },
    
                       items: [{
                           fieldLabel: 'First Name',
                           name: 'first',
                           allowBlank: false
                       }, {
                           fieldLabel: 'Last Name',
                           name: 'last'
                       }, {
                           fieldLabel: 'Company',
                           name: 'company'
                       }, {
                           fieldLabel: 'Email',
                           name: 'email',
                           vtype: 'email'
                       }, {
                           xtype: 'timefield',
                           fieldLabel: 'Time',
                           name: 'time',
                           minValue: '8:00am',
                           maxValue: '6:00pm'
                       }]
     }";
    
                Ext.Net.Window win = new Ext.Net.Window(config);
    Any help is highly appreciated. Thanks in advance.
    Last edited by geoffrey.mcgill; Apr 04, 2012 at 10:19 PM. Reason: please use [CODE] tags
  2. #2
    If you are on server side, you should use the server side window object to set those properties instead of putting a blob of string as config.
  3. #3
    I wanted to store the page metadata in the db and then get it back and render it on asp.net cs file that is why wanted to push the config in the windows control. can you please suggest some options on how to dynamically create page with controls.

Similar Threads

  1. Dynamically adding Controls to WebUserControl
    By bright in forum 1.x Help
    Replies: 8
    Last Post: Apr 27, 2012, 6:34 PM
  2. Replies: 4
    Last Post: Jan 31, 2011, 12:39 AM
  3. Replies: 1
    Last Post: Aug 17, 2010, 10:07 PM
  4. Replies: 2
    Last Post: Nov 04, 2009, 3:36 PM
  5. [CLOSED] Dynamically adding controls to a tav
    By riccardosarti in forum 1.x Help
    Replies: 3
    Last Post: Sep 24, 2008, 9:49 AM

Tags for this Thread

Posting Permissions