Auto PostBack

Discussion in 'ASP .Net Web Controls' started by Henri, Feb 5, 2007.

  1. Henri

    Henri Guest

    On a websitye, I have a webfom, with a Image and a RadioButtonList.
    When a user selects an item in the RadioButtonList, the property "ImageUrl"
    of the Image changes.
    If the property "AutoPostBack" of the RadioButtonList is at FALSE, changing
    the item don't change the image.
    If the property "AutoPostBack" is at TRUE, when the user change an item, the
    image is changed, but all the page is reloaded.
    How can I do to refresh only the image and not all the page ?
    Many thanks for your answer.
    Henri
    Henri, Feb 5, 2007
    #1
    1. Advertising

  2. My recommendation would be to use AJAX, but you might also be able to fix
    your problem by changing the EnableViewState property. Good Luck!
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "Henri" <> wrote in message
    news:...
    > On a websitye, I have a webfom, with a Image and a RadioButtonList.
    > When a user selects an item in the RadioButtonList, the property
    > "ImageUrl"
    > of the Image changes.
    > If the property "AutoPostBack" of the RadioButtonList is at FALSE,
    > changing
    > the item don't change the image.
    > If the property "AutoPostBack" is at TRUE, when the user change an item,
    > the
    > image is changed, but all the page is reloaded.
    > How can I do to refresh only the image and not all the page ?
    > Many thanks for your answer.
    > Henri
    Nathan Sokalski, Feb 5, 2007
    #2
    1. Advertising

  3. Henri

    ThunderMusic Guest

    hi,
    actually, no ajax needed (sorry Nathan)... javascript usually does the job
    in this kind of situation... though you'll have to do some job server side
    prior to displaying your page at once, it's pretty seemless afterward...
    here's an exemple of a resulting html :

    <html><head>whatever is your html head</head>
    <body>
    <script>
    function changeImage(imageURL) {
    var imgctl = document.getElementById('imgToChange');
    imgctl.src = imageURL;
    }
    </script>
    <p><img src="Whatever url" id="imgToChange" name="imgToChange" /></p>
    <p>
    <input type="radio" onclick="changeImage('an other url');" />some text<br>
    <input type="radio" onclick="changeImage('an other url');" />some other
    text<br>
    <input type="radio" onclick="changeImage('an other url');" />still some
    other text<br>
    </p>
    </body>
    </html>

    Actually, what you will need to do is add an OnClick event on each of your
    elements to display the right image... I think it's pretty straight forward
    and it works in all the browsers (well, I'm pretty sure)

    I hope it helps

    ThunderMusic


    "Henri" <> wrote in message
    news:...
    > On a websitye, I have a webfom, with a Image and a RadioButtonList.
    > When a user selects an item in the RadioButtonList, the property
    > "ImageUrl"
    > of the Image changes.
    > If the property "AutoPostBack" of the RadioButtonList is at FALSE,
    > changing
    > the item don't change the image.
    > If the property "AutoPostBack" is at TRUE, when the user change an item,
    > the
    > image is changed, but all the page is reloaded.
    > How can I do to refresh only the image and not all the page ?
    > Many thanks for your answer.
    > Henri
    ThunderMusic, Feb 6, 2007
    #3
  4. HTTP generally involves an entire page being refreshed. Your alternatives
    to refreshing an entire page are to either load all the images into hidden
    (style.display = 'none') and show them or insert nodes into the DOM tree via
    Javascript, or turn on ASP.Net SmartNavigation, which loads the entire
    response into a hidden iframe, DIFFs the two DOMs, and inserts the
    appropriate node from the iframe into the unrefreshed page, giving the
    appearance of a partial postback.
    Keith Patrick, Feb 6, 2007
    #4
    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. yoyo

    Auto Postback Issue

    yoyo, Aug 26, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    2,033
  2. Thomas Due
    Replies:
    0
    Views:
    553
    Thomas Due
    Apr 20, 2004
  3. Psych971
    Replies:
    5
    Views:
    4,588
    bruce barker
    Dec 17, 2004
  4. =?Utf-8?B?V2FyYW4=?=

    Auto-Suggested Textbox like google auto suggest

    =?Utf-8?B?V2FyYW4=?=, Apr 20, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    8,494
    inrakeshworld
    Jul 27, 2007
  5. linkswanted
    Replies:
    1
    Views:
    877
Loading...

Share This Page