Composite Control: LoadPostData() -> postCollection doesn't contain postDataKey

Discussion in 'ASP .Net Web Controls' started by Ralf Müller, Nov 24, 2004.

  1. Ralf Müller

    Ralf Müller Guest

    Hi all,

    I'm trying to implement the interface IPostBackDataHandler in a composite
    control in order to raise events depending on changes to the postback data.
    The examples on how to implement "LoadPostData" given by the msdn or
    different books all the same. They are all based on a custom TextBox with
    the following code in "LoadPostData":

    public bool LoadPostData(string postDataKey, NameValueCollection
    postCollection) {

    string postedValue = postCollection[postDataKey];

    if (!Text.Equals(postedValue)) {
    Text = postedValue;
    return true;
    }

    return false;
    }

    But I am developing a composite control and my postCollection just holds the
    following three keys __EVENTTARGET, __EVENTARGUMENT, __VIEWSTATE. I can't
    figure out why. I'm afraid this is really a newbie question but perhaps this
    makes it easier for you to help me...

    regards, ralf
     
    Ralf Müller, Nov 24, 2004
    #1
    1. Advertising

  2. Ralf Müller

    Ashish Kaila Guest

    Did u implement INamingContainer ? Just extend it, it has no methods but it
    tells the infrastructure to sealiaze ur control.
    Ashish
    "Ralf Müller" <> wrote in message
    news:efgj%...
    > Hi all,
    >
    > I'm trying to implement the interface IPostBackDataHandler in a composite
    > control in order to raise events depending on changes to the postback

    data.
    > The examples on how to implement "LoadPostData" given by the msdn or
    > different books all the same. They are all based on a custom TextBox with
    > the following code in "LoadPostData":
    >
    > public bool LoadPostData(string postDataKey, NameValueCollection
    > postCollection) {
    >
    > string postedValue = postCollection[postDataKey];
    >
    > if (!Text.Equals(postedValue)) {
    > Text = postedValue;
    > return true;
    > }
    >
    > return false;
    > }
    >
    > But I am developing a composite control and my postCollection just holds

    the
    > following three keys __EVENTTARGET, __EVENTARGUMENT, __VIEWSTATE. I can't
    > figure out why. I'm afraid this is really a newbie question but perhaps

    this
    > makes it easier for you to help me...
    >
    > regards, ralf
    >
    >
     
    Ashish Kaila, Nov 27, 2004
    #2
    1. Advertising

  3. Ralf Müller

    Ralf Müller Guest

    Hi Ashish,

    first of all - thank you for your reply.

    Yes I did implement INamingContainer since my composite control is a custom
    treeview control and therefore has a lot of child controls that need to have
    unique IDs.

    I guess it has something to do with the values I post back. But that should
    be all of my controls (public?) properties or am I getting something wrong
    here?

    Ralf

    "Ashish Kaila" <> schrieb im Newsbeitrag
    news:...
    > Did u implement INamingContainer ? Just extend it, it has no methods but

    it
    > tells the infrastructure to sealiaze ur control.
    > Ashish
     
    Ralf Müller, Nov 29, 2004
    #3
  4. Ralf Müller

    Ashish Kaila Guest

    Did you implement LoadViewState / SaveViewState then ?
    Ashish

    "Ralf Müller" <> wrote in message
    news:...
    > Hi Ashish,
    >
    > first of all - thank you for your reply.
    >
    > Yes I did implement INamingContainer since my composite control is a

    custom
    > treeview control and therefore has a lot of child controls that need to

    have
    > unique IDs.
    >
    > I guess it has something to do with the values I post back. But that

    should
    > be all of my controls (public?) properties or am I getting something wrong
    > here?
    >
    > Ralf
    >
    > "Ashish Kaila" <> schrieb im Newsbeitrag
    > news:...
    > > Did u implement INamingContainer ? Just extend it, it has no methods but

    > it
    > > tells the infrastructure to sealiaze ur control.
    > > Ashish

    >
    >
     
    Ashish Kaila, Dec 7, 2004
    #4
  5. Ralf Müller

    Ralf Müller Guest

    Hi Ashish!

    Should I? I thought my properties would be automatically saved to ViewState
    if I implemented them like this:

    public object ExampleProperty {
    get { return ViewState["ExampleProperty"]; }
    set { ViewState["ExampleProperty"] = value; }
    }

    Ralf

    "Ashish Kaila" <> schrieb im Newsbeitrag
    news:...
    > Did you implement LoadViewState / SaveViewState then ?
    > Ashish
    >
    > "Ralf Müller" <> wrote in message
    > news:...
    > > Hi Ashish,
    > >
    > > first of all - thank you for your reply.
    > >
    > > Yes I did implement INamingContainer since my composite control is a

    > custom
    > > treeview control and therefore has a lot of child controls that need to

    > have
    > > unique IDs.
    > >
    > > I guess it has something to do with the values I post back. But that

    > should
    > > be all of my controls (public?) properties or am I getting something

    wrong
    > > here?
    > >
    > > Ralf
    > >
    > > "Ashish Kaila" <> schrieb im Newsbeitrag
    > > news:...
    > > > Did u implement INamingContainer ? Just extend it, it has no methods

    but
    > > it
    > > > tells the infrastructure to sealiaze ur control.
    > > > Ashish

    > >
    > >

    >
    >
     
    Ralf Müller, Dec 8, 2004
    #5
  6. Ralf Müller

    Ashish Kaila Guest

    No then I don't think you need that. But usually I donot recommend going
    your way because name collision can occur. But it should work.
    Ashish

    "Ralf Müller" <> wrote in message
    news:...
    > Hi Ashish!
    >
    > Should I? I thought my properties would be automatically saved to

    ViewState
    > if I implemented them like this:
    >
    > public object ExampleProperty {
    > get { return ViewState["ExampleProperty"]; }
    > set { ViewState["ExampleProperty"] = value; }
    > }
    >
    > Ralf
    >
    > "Ashish Kaila" <> schrieb im Newsbeitrag
    > news:...
    > > Did you implement LoadViewState / SaveViewState then ?
    > > Ashish
    > >
    > > "Ralf Müller" <> wrote in message
    > > news:...
    > > > Hi Ashish,
    > > >
    > > > first of all - thank you for your reply.
    > > >
    > > > Yes I did implement INamingContainer since my composite control is a

    > > custom
    > > > treeview control and therefore has a lot of child controls that need

    to
    > > have
    > > > unique IDs.
    > > >
    > > > I guess it has something to do with the values I post back. But that

    > > should
    > > > be all of my controls (public?) properties or am I getting something

    > wrong
    > > > here?
    > > >
    > > > Ralf
    > > >
    > > > "Ashish Kaila" <> schrieb im Newsbeitrag
    > > > news:...
    > > > > Did u implement INamingContainer ? Just extend it, it has no methods

    > but
    > > > it
    > > > > tells the infrastructure to sealiaze ur control.
    > > > > Ashish
    > > >
    > > >

    > >
    > >

    >
    >
     
    Ashish Kaila, Dec 10, 2004
    #6
    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. Nathan Sokalski
    Replies:
    0
    Views:
    301
    Nathan Sokalski
    Aug 23, 2008
  2. Nathan Sokalski
    Replies:
    0
    Views:
    410
    Nathan Sokalski
    Aug 26, 2008
  3. Chad
    Replies:
    0
    Views:
    225
  4. Nathan Sokalski
    Replies:
    0
    Views:
    853
    Nathan Sokalski
    Aug 26, 2008
  5. Nathan Sokalski
    Replies:
    0
    Views:
    187
    Nathan Sokalski
    Aug 26, 2008
Loading...

Share This Page