Custom control is naming it's components differently

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan Sokalski

    #1

    Custom control is naming it's components differently

    I have written a custom control that uses AJAX (it implements
    IPostBackDataHa ndler and ICallbackEventH andler). I have tested it, and it
    seems to work the way I want. However, when I used it in another application
    of mine it named the components as ControlID$Compo nentID instead of
    ControlID:Compo nentID. I did not change any of the code, so obviously
    something else is making this happen. I need to have it name the components
    using ControlID:Compo nentID so that my code works. What might be causing
    this different naming method? Thanks.
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。



  • Riki

    #2
    Re: Custom control is naming it's components differently

    I don't know the cause of your problem, but I suggest that you don't try to
    predict the ID's of your controls, since the naming system may change in
    future versions of ASP.NET.

    Instead, use MyControl.Clien tID to get the real ID of your controls.

    --

    Riki

    "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
    news:evSAKN5LHH A.320@TK2MSFTNG P06.phx.gbl...
    >I have written a custom control that uses AJAX (it implements
    >IPostBackDataH andler and ICallbackEventH andler). I have tested it, and it
    >seems to work the way I want. However, when I used it in another
    >application of mine it named the components as ControlID$Compo nentID
    >instead of ControlID:Compo nentID. I did not change any of the code, so
    >obviously something else is making this happen. I need to have it name the
    >components using ControlID:Compo nentID so that my code works. What might be
    >causing this different naming method? Thanks.
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。

    >

    Comment

    • Nathan Sokalski

      #3
      Re: Custom control is naming it's components differently

      That would work, except for one small problem: I'm not talking about the id.
      When using AJAX, the IPostBackDataHa ndler interface is implemented, which
      contains a function called LoadPostData. This function has parameters called
      postDataKey and postCollection. To access the values of the different
      components, you use postCollection( postDataKey & "$ddlYear") . The expression
      postDataKey & "$ddlYear" evaluates to the client name, not the client id. I
      do not know of a property or function that returns the client name, so this
      is the only method I know of to get the component values, and it is also how
      I have seen it done by other people. Any ideas? Thanks.
      --
      Nathan Sokalski
      njsokalski@hotm ail.com
      有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


      "Riki" <riki@bounce.co mwrote in message
      news:O1HJvr%23L HHA.3952@TK2MSF TNGP02.phx.gbl. ..
      >I don't know the cause of your problem, but I suggest that you don't try to
      >predict the ID's of your controls, since the naming system may change in
      >future versions of ASP.NET.
      >
      Instead, use MyControl.Clien tID to get the real ID of your controls.
      >
      --
      >
      Riki
      >
      "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
      news:evSAKN5LHH A.320@TK2MSFTNG P06.phx.gbl...
      >>I have written a custom control that uses AJAX (it implements
      >>IPostBackData Handler and ICallbackEventH andler). I have tested it, and it
      >>seems to work the way I want. However, when I used it in another
      >>application of mine it named the components as ControlID$Compo nentID
      >>instead of ControlID:Compo nentID. I did not change any of the code, so
      >>obviously something else is making this happen. I need to have it name the
      >>components using ControlID:Compo nentID so that my code works. What might
      >>be causing this different naming method? Thanks.
      >--
      >Nathan Sokalski
      >njsokalski@hotm ail.com
      >http://www.nathansokalski.com/
      >>
      >
      >

      Comment

      • Peter Zolja

        #4
        Re: Custom control is naming it's components differently

        postDataKey & "$ddlYear" evaluates to the client name, not the client id.
        I do not know of a property or function that returns the client name, so
        this
        UniqueID


        Comment

        Working...