Refresh Not Happening

Discussion in 'ASP .Net' started by Wayne Wengert, Feb 23, 2005.

  1. I have an aspx page on which I trap a change in the selected radiobutton in
    a radiobuttonlist. In that event code, I change the visibility of some
    controls based on what button was selected. The change to the objects made
    in that routine does not take effect until the user clicks on another
    control (button or such)

    How can I get those changes to be immediately visible? I don't see anything
    like a Refresh?

    TIA

    Wayne
     
    Wayne Wengert, Feb 23, 2005
    #1
    1. Advertising

  2. Wayne  Wengert

    David Barkol Guest

    Solution 1:

    You need to register a javascript function for the onclick and onchange
    events.

    Example:

    <asp:radiobuttonlist id="RadioList1" onclick="RadioList1_Click();"
    onchange="RadioList1_Click();" RepeatColumns="2" RepeatLayout="Flow"
    Runat="server">

    In the 'RadioList1_Click' function you can then set the style.display
    value to ' ' or 'none' for the controls you want to display.

    Solution 2:
    If you rather do this on the server side then you will need a post back
    and you can just call Response.Redirect to refresh the page.

    David Barkol
    www.neudesic.com
     
    David Barkol, Feb 23, 2005
    #2
    1. Advertising

  3. > Solution 2:
    > If you rather do this on the server side then you will need a post back
    > and you can just call Response.Redirect to refresh the page.


    Soultion 3:

    In your class you declare a bool eg. HideMyElements = false;

    In your event handler for the radiobutton list you set HideMyElements =
    true;

    Now the essential part. You can still manage to get your update with the
    request if you declare

    protected override OnPreRender(......)
    {
    if(HideMyElements )
    {
    control.visible = false;
    }
    }

    Hope I undestood your question

    Regards
    Anders Jacobsen
     
    Anders K. Jacobsen [DK], Feb 23, 2005
    #3
  4. Thanks guys. I plan to experiment with a couple of those suggestions to see
    if I understand them I have very little javascript knowledge so this will be
    a chance to try out some things.

    Wayne

    "David Barkol" <> wrote in message
    news:...
    > Solution 1:
    >
    > You need to register a javascript function for the onclick and onchange
    > events.
    >
    > Example:
    >
    > <asp:radiobuttonlist id="RadioList1" onclick="RadioList1_Click();"
    > onchange="RadioList1_Click();" RepeatColumns="2" RepeatLayout="Flow"
    > Runat="server">
    >
    > In the 'RadioList1_Click' function you can then set the style.display
    > value to ' ' or 'none' for the controls you want to display.
    >
    > Solution 2:
    > If you rather do this on the server side then you will need a post back
    > and you can just call Response.Redirect to refresh the page.
    >
    > David Barkol
    > www.neudesic.com
    >
     
    Wayne Wengert, Feb 23, 2005
    #4
  5. David;

    I tried to apply the suggestion to register the JavaScript function but the
    "onclick" and "onchange" clauses get flagged as "could not find any onclick
    attribute for radiobuttonlist?

    Wayne

    "David Barkol" <> wrote in message
    news:...
    > Solution 1:
    >
    > You need to register a javascript function for the onclick and onchange
    > events.
    >
    > Example:
    >
    > <asp:radiobuttonlist id="RadioList1" onclick="RadioList1_Click();"
    > onchange="RadioList1_Click();" RepeatColumns="2" RepeatLayout="Flow"
    > Runat="server">
    >
    > In the 'RadioList1_Click' function you can then set the style.display
    > value to ' ' or 'none' for the controls you want to display.
    >
    > Solution 2:
    > If you rather do this on the server side then you will need a post back
    > and you can just call Response.Redirect to refresh the page.
    >
    > David Barkol
    > www.neudesic.com
    >
     
    Wayne Wengert, Feb 24, 2005
    #5
  6. Wayne  Wengert

    David Barkol Guest

    Wayne Wengert wrote:
    > David;
    >
    > I tried to apply the suggestion to register the JavaScript function

    but the
    > "onclick" and "onchange" clauses get flagged as "could not find any

    onclick
    > attribute for radiobuttonlist?
    >
    > Wayne
    >


    Don't worry about the flag, it will work. Throw an alert up in the
    function to confirm.

    - David
     
    David Barkol, Feb 25, 2005
    #6
  7. Thanks - that helps!

    Wayne

    "David Barkol" <> wrote in message
    news:...
    >
    > Wayne Wengert wrote:
    > > David;
    > >
    > > I tried to apply the suggestion to register the JavaScript function

    > but the
    > > "onclick" and "onchange" clauses get flagged as "could not find any

    > onclick
    > > attribute for radiobuttonlist?
    > >
    > > Wayne
    > >

    >
    > Don't worry about the flag, it will work. Throw an alert up in the
    > function to confirm.
    >
    > - David
    >
     
    Wayne Wengert, Feb 25, 2005
    #7
    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. raj

    Upload not happening!

    raj, Jul 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    366
    Joerg Jooss
    Jul 20, 2003
  2. Smithers

    CSS File Refresh is Not Happening

    Smithers, May 10, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    1,188
    Vladimir V
    May 11, 2005
  3. =?Utf-8?B?YWJoaWppdA==?=

    Forms authentication is not happening in MAC OS 9.5

    =?Utf-8?B?YWJoaWppdA==?=, Aug 30, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    506
    =?Utf-8?B?YWJoaWppdA==?=
    Aug 30, 2005
  4. Guadala Harry

    Client Side Validation is Not Happening

    Guadala Harry, Sep 13, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,193
    Guadala Harry
    Sep 14, 2005
  5. Ross Culver

    What's Happening When I Click Refresh?

    Ross Culver, Aug 7, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    342
    Ross Culver
    Aug 7, 2007
Loading...

Share This Page