c# - RedirectTo a tab in the same aspx page using a case statement -
i have site there 5 tabs on 1 page. "next" , "back" buttons work navigating between tabs, using enum tab references , using redirectto in case statement navigate between tabs. tabs' urls #whathappened, etc. not working, happens url changes reflect new address old tab active , data gone tab though using function save, why not using javascript this.
any ideas great.
code in save function...
protected void saveeventdetails(object sender, commandeventargs e) { bool issubmitted = false; pagelocation pagelocation = (pagelocation)session["pagelocation"]; switch (e.commandname) { case "back": if (_eventid == 0) { save(false, mode.edit, status.save); redirectto(pagelocation - 1); } else update(_eventid, false, status.save); redirectto(pagelocation - 1); break; case "next": if (_eventid == 0) { save(false, mode.edit, status.save); redirectto(pagelocation + 1); } else update(_eventid, false, status.save); redirectto(pagelocation + 1); break;
code in redirect function...
public void redirectto(pagelocation pagelocation) { switch (pagelocation) { case pagelocation.approvalactions: response.redirect("#tabinvestigatoraction"); break; case pagelocation.whowasinvolved: response.redirect("#tabinvolved"); break; case pagelocation.questions: response.redirect("#tabquestions"); break; case pagelocation.investigatorcomments: response.redirect("#tabnotes"); break; case pagelocation.attachmentsandcomments: response.redirect("tabattachmentscomments"); break; default: response.redirect("#tabwhathappened"); break; } }
enum code...
public enum pagelocation { whathappend = 1, questions, whowasinvolved, attachmentsandcomments, investigatorcomments, approvalactions, }
aspx page code...
<asp:button id="btnback" commandname="back" oncommand="saveeventdetails" runat="server" class="buttoncolor" text="back" /> <asp:button id="btnnext" commandname="next" oncommand="saveeventdetails" runat="server" class="buttoncolor" style="margin-right: 30px;" text="next" />
you can use jquery ui tabs , use tab id in url go tab.
also if using server tab control, make sure client id same providing in url
Comments
Post a Comment