Dynamicly setting readonly in through a property

Discussion in 'ASP .Net Building Controls' started by Martin Gregersen, Nov 27, 2006.

  1. 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
     
    Martin Gregersen, Nov 27, 2006
    #1
    1. Advertising

  2. Martin Gregersen

    Masudur Guest

    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
    www.kaz.com.bd
    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
    >
     
    Masudur, Nov 27, 2006
    #2
    1. Advertising

  3. Hi Masudur

    Thanks for your swift reply, turns out you are right. :eek:) 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



    "Masudur" <> wrote in message
    news:...
    > 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
    > www.kaz.com.bd
    > 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
    >>

    >
     
    Martin Gregersen, Nov 27, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Maz
    Replies:
    4
    Views:
    18,968
    Jon Maz
    Feb 20, 2004
  2. =?iso-8859-1?q?Joey_Ch=F6mpff?=

    ObjectDataSource and ReadOnly Object Property

    =?iso-8859-1?q?Joey_Ch=F6mpff?=, Jan 13, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    511
    =?iso-8859-1?q?Joey_Ch=F6mpff?=
    Jan 13, 2006
  3. Martin Gregersen

    Dynamicly setting readonly in through a property

    Martin Gregersen, Nov 27, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    399
    Martin Gregersen
    Nov 27, 2006
  4. Jonathan Hyatt
    Replies:
    1
    Views:
    1,949
    Jonathan Hyatt
    Jun 8, 2004
  5. Martin Gregersen

    Dynamicly setting readonly in through a property

    Martin Gregersen, Nov 27, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    123
    Martin Gregersen
    Nov 27, 2006
Loading...

Share This Page