[CLOSED] How to access the property of user control in client side (by javascript)

  1. #1

    [CLOSED] How to access the property of user control in client side (by javascript)

    Hi:

    I have a user control which is inherit from Ext.Net.Window. In the user control I have some buttons and text fields. I also add some extra properties in this user control, like "Name". Now we can easy access the "Name" in the server side but can not get the property value in client side, like by javascript. Is there any way I can access the property value by javascript?

    Thank you
    Last edited by Daniil; Jul 28, 2011 at 5:06 PM. Reason: [CLOSED]
  2. #2
    Add that property to CustomConfig of the window, after that you can read it on the client side
    Window1.myPropertyName
    Please note that first symbol will have lower case
  3. #3
    Quote Originally Posted by Vladimir View Post
    Add that property to CustomConfig of the window, after that you can read it on the client side
    Window1.myPropertyName
    Please note that first symbol will have lower case
    Thank you Vladimir, that'll work. But the markup in the page will like this:

    <UserControl: UserControl1 runat="server" Name="test" ......>
           <CustomConfig>
                  <ext:ConfigItem Name="Name" Value="test" Mode="Raw">
                  </ext:ConfigItem>
           </CustomConfig>
    </UserControl: UserControl1>
    This needs to define the "Name" value twice, also, when I change the value of "Name", I will need to update the Name twice which are both on server side and client side. Is there anyway I can automatically let them map each other so that I can only update in one side and the other side will automatically catch the change?

    Thank you
  4. #4
    You can add property to CustomConfig in the PreRender event of user control
  5. #5
    Quote Originally Posted by Vladimir View Post
    You can add property to CustomConfig in the PreRender event of user control
    Yes, I can add property value to CustomConfig in the PreRender event of user control. but there still a problem yet

    I create a user control which is inherit from Ext.Net.Window. In this user control, I have a text field which is for Name. I create a property in user control which is named "Name" as well, So in PreRender event of user control, I can bind the textfield text with property value. However I can also create a ConfigItemin CustomConfig and bind the value with property value. This is all work good for page load. But when you update the textfield text, and check the ConfigItem's value in client side. The value of ConfigItem will not change. It is still the initial value. Is there any way that the ConfigItem will update when the textfield text changed.

    Thank you
  6. #6
    You have to update property manually (for example, in Change event handler of text field)
  7. #7
    Quote Originally Posted by Vladimir View Post
    You have to update property manually (for example, in Change event handler of text field)
    em...OK. Thanks

Similar Threads

  1. Replies: 7
    Last Post: Apr 14, 2011, 10:52 PM
  2. Replies: 2
    Last Post: Mar 28, 2011, 9:20 AM
  3. [CLOSED] Can't access a slider field during client-side onload
    By ewgoforth in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 31, 2011, 7:38 PM
  4. Replies: 1
    Last Post: Mar 09, 2010, 2:55 AM
  5. Replies: 2
    Last Post: Aug 27, 2009, 8:12 AM

Posting Permissions