c# - use QueryString with asp:MenuItem -


How do I cross a string with a query string from a menuItem? I tried

/UserDisplay.aspx?UserName=<% (string) session ["sessUserName"]% & gt; "

But these errors returned ..

Is there a way to do this within the Mentoum, or do I have to do it in an OnClick event?

According to the request, more code:

  & lt; ASP: Menu id = "NavigationMenu" runat = "server" CssClass = "menu" EnableViewState = "false" IncludeStyleBlock = " False "orientation =" horizontal "onmenuitemclick =" navigationMenu_MenuItemClick ">   gt; & lt; asp : MenuItem NavigateUrl = "~ / UserManagement / UserManagement.aspx" text = "User Management" & gt; & lt; Asp: Men UItem NavigateUrl = "~ / UserManagement / UserManagement.aspx" text = "Manage Users" & gt; asp: MenuItem NavigateUrl = "~ / UserManagement / UserDisplay.aspx" text = "New User" / & gt; & Lt; / ASP: MenuIMUM> ASP: Menu Itam Navigate URL = "~ / UserManagement / UserDisplay.Aspx? Username = & lt;% (string) session ["Asus Username"]% & gt; "Text =" FYI Entrance Request "/> & Lt; / This EMS & gt; & lt; / ASP: Menu & gt; < Try the following text "itemprop =" text "> 

="

  & lt; ap : MenuItem NavigateUrl = '~ / UserManagement / UserDisplay.aspx Username = & lt;?% = (String) session ["sessUserName"]% & gt; Text = "FYI login request" />   

I have not worked with WebForms as recently but I think you need to use & lt;% = <> Code tag ( & lt; %% & gt; ) as opposed to. I also remember some issues where single quotes rather than double quotes The quote ( ') was used, but it may or may be an issue.

Edit

It seems that you About it E-remember back:

  public void MyAccountLinkInit (object sender, Iventargs Arges) {((MenuItem) from) .NavigateUrl = "~ / UserManagement / UserDisplay.aspx? User Name = "+ Session [" sessUserName "];}   

... and this handler wire-up like this:

  & lt; ASP: MenuItem OnInit = "MyAccountLinkInit" text = "FYI access request" />    

Comments