Search code examples
.netasp.netmultiview

view in multiview timeout


Basically what I want to do is "timeout" a view. Similar to a javascript redirect after a certain amount of time except instead of redirecting, switching to a different view in the multiview. Anyone know how to do this?


Solution

  • Since MultiView doesn't have a client-side API, the way to do this is to manually create a __doPostBack call with the multiview ID as the source:

    __doPostBack('<%= multiview.UniqueID %>', 'switch');
    

    The second parameter is the event name/args; you can manually check this on the postback via:

    if (Request.Form["__EVENTTARGET"] != null && 
        Request.Form["__EVENTTARGET"].EndsWith(multiview.ID) && 
        Request.Form["__EVENTARGUMENT"] == "switch")
    

    And then switch the current view; there may already be a built-in command name to do this, I am not sure of that.