Dynamicly setting readonly in through a property

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Dynamicly setting readonly in through a property

    Hi

    Looking for a way to bind a readonly property on a textbox to a parameter,
    not having to cycle through all controls, but rather setting <textbox
    id="myTextbox" readonly="<%# SetReadOnly %> where SetReadOnly is a public
    property, saved to a Session variable.

    Can't get it to work, eventhough the designer shows and says that it is
    databound... When I debug I can see that it never accesses the property, as
    if it just says 'Okay, the vaule "<%# SetReadOnly %>" is not "true", it must
    be "false"...'

    Hope somebody can (and will ;o) ) help me...

    Thanks...

    Martin Gregersen
    WebShine A/S
    [email]gregersen@webshine.dk[/email]


    Martin Gregersen Guest

  2. Similar Questions and Discussions

    1. .Net 2.0 : Smart tags and Readonly Collection Property
      Hi, I've built a composite control with a ReadOnly custom collection property. I can manage collection items in the property editor with a...
    2. Composite Control Property Setting Problem
      I have built a simple composite control that consists of a textbox, requiredfieldvalidator and rangevalidator. For properties that are unique to...
    3. Setting user control property dynamically?
      Hi I created a user control that has a property that accepts a url ("NavUrl").. I tried to set the value as follows directly in the aspx page...
    4. Setting a control property
      I have a custom composite control which reads in information from an XML file in its createchildcontrols() event. I would like to be able to set...
    5. Error Setting user control property at web form
      Dear Friends Hope things goes well to you. I have this problem. Would you please give me your solution? I want to change a property that I...
  3. #2

    Default Re: Dynamicly setting readonly in through a property

    Dear Martin,

    I am not sure about the actual context of your problem.

    If you set a data binding code that refers to a public variable of the
    page. You must call Page.DataBind() to bind the variable to target
    element. Please Check wheither you have Page.DataBind() method called
    in your pageload event.

    Thanks.
    Md. Masudur Rahman
    [url]www.kaz.com.bd[/url]
    KAZ Software Ltd.
    Software outsourcing made simple...

    Martin Gregersen wrote:
    > Hi
    >
    > Looking for a way to bind a readonly property on a textbox to a parameter,
    > not having to cycle through all controls, but rather setting <textbox
    > id="myTextbox" readonly="<%# SetReadOnly %> where SetReadOnly is a public
    > property, saved to a Session variable.
    >
    > Can't get it to work, eventhough the designer shows and says that it is
    > databound... When I debug I can see that it never accesses the property, as
    > if it just says 'Okay, the vaule "<%# SetReadOnly %>" is not "true", it must
    > be "false"...'
    >
    > Hope somebody can (and will ;o) ) help me...
    >
    > Thanks...
    >
    > Martin Gregersen
    > WebShine A/S
    > [email]gregersen@webshine.dk[/email]
    Masudur Guest

  4. #3

    Default Re: Dynamicly setting readonly in through a property

    Hi Masudur

    Thanks for your swift reply, turns out you are right. :o) I just added a
    "Databind();" ind the Page_Load(), and then it worked...

    I actually found out myself shortly after posting this question - and now I
    wanted to go close it myself, but you where faster than me ;o)

    Martin Gregersen
    WebShine A/S
    [email]gregersen@webshine.dk[/email]


    "Masudur" <munnacs@gmail.com> wrote in message
    news:1164620045.129685.153710@l39g2000cwd.googlegr oups.com...
    > Dear Martin,
    >
    > I am not sure about the actual context of your problem.
    >
    > If you set a data binding code that refers to a public variable of the
    > page. You must call Page.DataBind() to bind the variable to target
    > element. Please Check wheither you have Page.DataBind() method called
    > in your pageload event.
    >
    > Thanks.
    > Md. Masudur Rahman
    > [url]www.kaz.com.bd[/url]
    > KAZ Software Ltd.
    > Software outsourcing made simple...
    >
    > Martin Gregersen wrote:
    >> Hi
    >>
    >> Looking for a way to bind a readonly property on a textbox to a
    >> parameter,
    >> not having to cycle through all controls, but rather setting <textbox
    >> id="myTextbox" readonly="<%# SetReadOnly %> where SetReadOnly is a public
    >> property, saved to a Session variable.
    >>
    >> Can't get it to work, eventhough the designer shows and says that it is
    >> databound... When I debug I can see that it never accesses the property,
    >> as
    >> if it just says 'Okay, the vaule "<%# SetReadOnly %>" is not "true", it
    >> must
    >> be "false"...'
    >>
    >> Hope somebody can (and will ;o) ) help me...
    >>
    >> Thanks...
    >>
    >> Martin Gregersen
    >> WebShine A/S
    >> [email]gregersen@webshine.dk[/email]
    >

    Martin Gregersen Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139