usercontrol refresh

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rob Koch

    #1

    usercontrol refresh

    What's the best way to refresh a usercontrol using a parameter? My
    usercontrol is just a DataList that retrieves data from SQL in association
    with a public propterty.

    I click on a LinkButton in my main page (ASPX), but it still refreshes the
    entire page... I only want the UserControl to blink and come back with new
    data.

    What's the direction I should be looking at? Even if I do it via
    JavaScript, how would I refresh the UserControl using JavaScript?

    TIA,
    -roko



  • Tim S.

    #2
    usercontrol refresh

    My hunch is that this is not possible. Here's why:
    1 - JavaScript cannot trigger anything on the server. UC
    are run at the server. Therefore JS alone could not
    trigger anything for a UC to refresh.

    2 - UC ultimately get generated into regular HTML that is
    merged with the rest of your page, just look at the view
    source HTML from your browser. To re-generate the UC
    requires re-generating the entire page.

    In terms of solutions, would caching help out? Perhaps
    putting the UC in a sub-frame so that it still has its own
    page that refreshes?

    HTH,
    Tim Stall

    [color=blue]
    >-----Original Message-----
    >What's the best way to refresh a usercontrol using a[/color]
    parameter? My[color=blue]
    >usercontrol is just a DataList that retrieves data from[/color]
    SQL in association[color=blue]
    >with a public propterty.
    >
    >I click on a LinkButton in my main page (ASPX), but it[/color]
    still refreshes the[color=blue]
    >entire page... I only want the UserControl to blink and[/color]
    come back with new[color=blue]
    >data.
    >
    >What's the direction I should be looking at? Even if I[/color]
    do it via[color=blue]
    >JavaScript, how would I refresh the UserControl using[/color]
    JavaScript?[color=blue]
    >
    >TIA,
    >-roko
    >
    >
    >
    >.
    >[/color]

    Comment

    • Tim S.

      #3
      usercontrol refresh

      My hunch is that this is not possible. Here's why:
      1 - JavaScript cannot trigger anything on the server. UC
      are run at the server. Therefore JS alone could not
      trigger anything for a UC to refresh.

      2 - UC ultimately get generated into regular HTML that is
      merged with the rest of your page, just look at the view
      source HTML from your browser. To re-generate the UC
      requires re-generating the entire page.

      In terms of solutions, would caching help out? Perhaps
      putting the UC in a sub-frame so that it still has its own
      page that refreshes?

      HTH,
      Tim Stall

      [color=blue]
      >-----Original Message-----
      >What's the best way to refresh a usercontrol using a[/color]
      parameter? My[color=blue]
      >usercontrol is just a DataList that retrieves data from[/color]
      SQL in association[color=blue]
      >with a public propterty.
      >
      >I click on a LinkButton in my main page (ASPX), but it[/color]
      still refreshes the[color=blue]
      >entire page... I only want the UserControl to blink and[/color]
      come back with new[color=blue]
      >data.
      >
      >What's the direction I should be looking at? Even if I[/color]
      do it via[color=blue]
      >JavaScript, how would I refresh the UserControl using[/color]
      JavaScript?[color=blue]
      >
      >TIA,
      >-roko
      >
      >
      >
      >.
      >[/color]

      Comment

      • Rob Koch

        #4
        Re: usercontrol refresh

        As a quick fix, what I did was load all those UCs that I need (3 images with
        links vertically on the right side), enclosed them all within their own div
        tags. So for 4 user controls, I have them all enclosed in 4 div tags. I
        used javascript to show/hide these div tags, i.e.
        document.getEle mentById("uc1") .style.display = 'block'); or
        document.getEle mentById("uc1") .style.display = 'none');

        I found this method thanks to this link:


        As it is done, three images shows up in the UC (as there's only enough room
        for it), but if I was to do some pagination in that datalist of images, I
        think I will be stuck, but otherwise, I'm OK for the time being...

        Still not a be-all, end-all solution, but worth working towards... :-)

        -roko

        "Tim S." <timstall@hotma il.com> wrote in message
        news:003901c34a 2d$f53a0570$a50 1280a@phx.gbl.. .[color=blue]
        > My hunch is that this is not possible. Here's why:
        > 1 - JavaScript cannot trigger anything on the server. UC
        > are run at the server. Therefore JS alone could not
        > trigger anything for a UC to refresh.
        >
        > 2 - UC ultimately get generated into regular HTML that is
        > merged with the rest of your page, just look at the view
        > source HTML from your browser. To re-generate the UC
        > requires re-generating the entire page.
        >
        > In terms of solutions, would caching help out? Perhaps
        > putting the UC in a sub-frame so that it still has its own
        > page that refreshes?
        >
        > HTH,
        > Tim Stall
        >
        >[color=green]
        > >-----Original Message-----
        > >What's the best way to refresh a usercontrol using a[/color]
        > parameter? My[color=green]
        > >usercontrol is just a DataList that retrieves data from[/color]
        > SQL in association[color=green]
        > >with a public propterty.
        > >
        > >I click on a LinkButton in my main page (ASPX), but it[/color]
        > still refreshes the[color=green]
        > >entire page... I only want the UserControl to blink and[/color]
        > come back with new[color=green]
        > >data.
        > >
        > >What's the direction I should be looking at? Even if I[/color]
        > do it via[color=green]
        > >JavaScript, how would I refresh the UserControl using[/color]
        > JavaScript?[color=green]
        > >
        > >TIA,
        > >-roko
        > >
        > >
        > >
        > >.
        > >[/color][/color]


        Comment

        • Rob Koch

          #5
          Re: usercontrol refresh

          As a quick fix, what I did was load all those UCs that I need (3 images with
          links vertically on the right side), enclosed them all within their own div
          tags. So for 4 user controls, I have them all enclosed in 4 div tags. I
          used javascript to show/hide these div tags, i.e.
          document.getEle mentById("uc1") .style.display = 'block'); or
          document.getEle mentById("uc1") .style.display = 'none');

          I found this method thanks to this link:


          As it is done, three images shows up in the UC (as there's only enough room
          for it), but if I was to do some pagination in that datalist of images, I
          think I will be stuck, but otherwise, I'm OK for the time being...

          Still not a be-all, end-all solution, but worth working towards... :-)

          -roko

          "Tim S." <timstall@hotma il.com> wrote in message
          news:003901c34a 2d$f53a0570$a50 1280a@phx.gbl.. .[color=blue]
          > My hunch is that this is not possible. Here's why:
          > 1 - JavaScript cannot trigger anything on the server. UC
          > are run at the server. Therefore JS alone could not
          > trigger anything for a UC to refresh.
          >
          > 2 - UC ultimately get generated into regular HTML that is
          > merged with the rest of your page, just look at the view
          > source HTML from your browser. To re-generate the UC
          > requires re-generating the entire page.
          >
          > In terms of solutions, would caching help out? Perhaps
          > putting the UC in a sub-frame so that it still has its own
          > page that refreshes?
          >
          > HTH,
          > Tim Stall
          >
          >[color=green]
          > >-----Original Message-----
          > >What's the best way to refresh a usercontrol using a[/color]
          > parameter? My[color=green]
          > >usercontrol is just a DataList that retrieves data from[/color]
          > SQL in association[color=green]
          > >with a public propterty.
          > >
          > >I click on a LinkButton in my main page (ASPX), but it[/color]
          > still refreshes the[color=green]
          > >entire page... I only want the UserControl to blink and[/color]
          > come back with new[color=green]
          > >data.
          > >
          > >What's the direction I should be looking at? Even if I[/color]
          > do it via[color=green]
          > >JavaScript, how would I refresh the UserControl using[/color]
          > JavaScript?[color=green]
          > >
          > >TIA,
          > >-roko
          > >
          > >
          > >
          > >.
          > >[/color][/color]


          Comment

          Working...