Click here to Skip to main content
15,125,547 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm currently using Request.QueryString to pass id. Just like below
C#
Response.Redirect("Page1.aspx?dpid=" + Request.QueryString["dpid"] + "&eid=" + Request.QueryString["eid"]);


So if I use menu to go to another page, the query string will not be pass because i unable to pass the query string in menu.

ASP.NET
<asp:menu id="Menu1" runat="server" maximumdynamicdisplaylevels="10" cssclass="menu" 
="" orientation="Horizontal" staticdisplaylevels="5" staticsubmenuindent="16px" width="900px">
        <items>
            <asp:menuitem navigateurl="~/Page1.aspx" text="View IT Asset" 
="" value="View IT Asset">
            <asp:menuitem navigateurl="~/Page2.aspx" text="View IT Asset Type" 
="" value="View IT Asset Type">
            <asp:menuitem navigateurl="~/Page3.aspx" text="Dispose" value="Dispose">
            
            <asp:menuitem navigateurl="~/Page4.aspx" text="View Request" 
="" value="View Request">
            <asp:menuitem navigateurl="~/Page5.aspx" text="Issue/Reject" 
="" value="Issue/Reject">
            <asp:menuitem navigateurl="~/Page6.aspx" text="Return Device" 
="" value="Return Device">
        
        <staticitemtemplate>
            <%# Eval("Text") %>


What I have tried:

So I am currently using button on every page to do it like menu. Just like below. It's work to pass the query string but it's look messy. Is that possible to pass query string in menu or any other better solution?
C#
protected void Button3_Click(object sender, EventArgs e)
        {
            Response.Redirect("Page1.aspx?dpid=" + Request.QueryString["dpid"] + "&eid=" + Request.QueryString["eid"]);
        }

        protected void Button4_Click(object sender, EventArgs e)
        {
            Response.Redirect("Page2.aspx?dpid=" + Request.QueryString["dpid"] + "&eid=" + Request.QueryString["eid"]);
        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            Response.Redirect("Page3.aspx?dpid=" + Request.QueryString["dpid"] + "&eid=" + Request.QueryString["eid"]);
        }

        protected void Button6_Click(object sender, EventArgs e)
        {
            Response.Redirect("Page4.aspx?dpid=" + Request.QueryString["dpid"] + "&eid=" + Request.QueryString["eid"]);
        }

        protected void Button7_Click(object sender, EventArgs e)
        {
            Response.Redirect("Page5.aspx?dpid=" + Request.QueryString["dpid"] + "&eid=" + Request.QueryString["eid"]);
        }

        protected void Button8_Click(object sender, EventArgs e)
        {
            Response.Redirect("Page6.aspx?dpid=" + Request.QueryString["dpid"] + "&eid=" + Request.QueryString["eid"]);
        }
Posted
Updated 11-Mar-21 20:40pm
v3
Comments
NotTodayYo 12-Mar-21 7:42am
   
To do it in the menu you need to know what the value is when the menu is built and then do it through code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900