Menu control : Cross page posting and posted values in nested controls?

I've created a dyrnamic template for a menu control which renders either a textbox or a linkbutton. The textbox acts as an search input field. The value of this field then acts as input to another page(on another frame actually).

What happens is that clicking on the linkbutton will do a postback to Main.aspx(which resides in a frame called 'MainWindow').

When the value arrives at Main.aspx, I see the value from 'searchMovies' textbox posted into the Request.form collection as : 'NavigationMenu$ctl05$searchMovies' with the value that was keyed in.

From main.aspx, does anyone know how I can retrieve the value of the searchMovies inputbox programatically? Perhaps starting with PreviousPage.FindControl("NavigationMenu") and so forth, and finally being able to get something like .FindControl("searchMovies") ? My last option would be to parse the Request.Form collection if it can't be done this way.

Would appreciate any input or help..

Sample code below :

Public Class MenuTemplate

   Implements ITemplate

Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements System.Web.UI.ITemplate.InstantiateIn

   Dim lb As New LinkButton
   Dim inp As New TextBox
   
Dim mtc As MenuItemTemplateContainer
   
Dim mi As MenuItem

   mtc = CType(container, MenuItemTemplateContainer)
   mi =
CType(mtc.DataItem, MenuItem)

   If mi.Text = "searchMovies" Then
      inp.ID = "searchMovies"
      inp.Attributes.Add("onClick", "event.cancelBubble=true;event.returnValue=false;")
      container.Controls.Add(inp)
Else
      lb.Text = mi.Text
      lb.PostBackUrl =
"main.aspx"
      container.Controls.Add(lb)
End If

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

   ...........some code.........

   client.RegisterOnSubmitStatement(Me.GetType,    "submit"      "Form1.action='Main.aspx';Form1.target='MainWindow';")

   NavigationMenu.DynamicItemTemplate = New MenuTemplate(sm)

End Sub

<html>
<body>
<form id="Form1" runat="server" action="Main.aspx">
<h3>Menu MenuItemClick Example</h3>

<asp:menu id="NavigationMenu"
   
staticdisplaylevels="2" staticsubmenuindent="10px"
   
orientation="Horizontal" onmenuitemclick="NavigationMenu_MenuItemClick"
   
target="MainWindow" runat="server">

<items>
   
<asp:menuitem text="Movies"tooltip="Movies" value="Movies">
      
<asp:menuitem text="Action" tooltip="Action" value="Action" navigateurl="Main.aspx" />
      
<asp:menuitem text="Drama" tooltip="Drama" value="Drama" navigateurl="Main.aspx" />
      
<asp:menuitem text="Musical" tooltip="Musical" value="Musical" target="MainWindow" navigateurl="Main.aspx"/>
      
<asp:menuitem text="searchMovies" tooltip="Search Movies" value="searchMovies"/>

   </asp:menuitem>
</items>

</asp:menu>
</form></body></html>

0
skeevs
3/23/2006 5:13:44 AM
asp.net.navigation-controls 13714 articles. 0 followers. Follow

0 Replies
849 Views

Similar Articles

[PageSpeed] 27

Reply:

Similar Artilces:

How to do post back in a dynamically created user control [provided that update panel is in the master page of the page where user control is added] {B/C of FileUpload Control}
I have a register my scriptmanager and place the update panel around contenttempalte for my pages int the master page. Now in one of my pages i am adding some user controls dynamically. In two of my user user controls I have FileUpload control which will not work under partial post back. So I want's full postback for them How could I do that {Provided that i am on the user control,which is inside the page ,and page have the contenttemplat...

Control of the page and the controls on a page
I am building a web app that has some pages that are public and some that are only available based on subscription. Could someone explain the best way (infrastructure wise) how to control whether a server control is visible or enabledand how to control whether a page is viewable or not based on the user and whether or not the user is logged in (or not). If a user is not logged in I would like some controls to be visible but disabled. I also have to control the URL's in case a person learnsthe URL and tries to type it in. My question is more towards how to do this database wise. I am u...

How to maintain form controls value after user control post back?
 hello experts, I have created filter grid in asp.net & C#.My form design has contains 3 dropdown controls and Filter grid(User control).Its working fine(filter), but one problem arise.the form controls are clear when i filter a grid(post back).I tried to reterive values using view state, hidden controls, i got only null values.Anyone please help, its urgent to me. Its my user control code.FilterGrid.aspx<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FilterGrid.ascx.cs" Inherits="FilterGrid" %><style type = "text/css&...

The menu control is out of my control
Here's my situation, I've been searching for about 2 weeks to try to do this without any luck. My limited knowledge of ASP doesn't help but I should have found an answer by now because it seems so simple. So here it is. I'm using the menu control and the CSS Friendly Control Adapters 2.0 to make it a bit easier to apply CSS to. ShowStartingNode is set to false because I want to see the whole menu. I have the menu just how I want it. Now, I want to be able to hide certain nodes in the menu. Not so users cant access them (some people have suggested using access control but this...

How do you control the menu control?
I am using the ASP 2.0 menu control.  When my submenus display, they display on top of the text that is already there from the content page.  The result is an unreadable mixture of text from both the page and the submenu.  Is there a way to force the submenu text to be on top of the content page's text without showing the content page text?  I don't see a property that can do this.  Thanks. The pop out panels should not be transparent and they should appear on top of the content page (unless the z-index of your controls are greater than 1). Please could you pr...

Posting Server Control to Controller Class
 Hi, this isn't a typical mvc approach. I have a view which has a server control i know its not the way to build MVC however i need to functionality of the control and don't want to re-write the wheel. Now I can't successfully post an action to control e.g.        [AcceptVerbs(HttpVerbs.Post)]        public ActionResult Upgrade()        {            return View();        } however I ...

How to access page control (editor control) from user control?
Hi, I want to do something, but I don't know if it's even possible. I'm trying to make a simple application to edit my website. I have a page called editPage.aspx which contains an editor control. (cuteEditor from cutesoft) I also have a Treeview that dynamically populates my website structure. I placed this treeview in a custom control (populateTreeView.ascx) and placed it on the editPage.aspx page. When you click on a html file in the treeview (inside the custom control) I check if the file exists. If it does exists I send it to a class which retrieves the editable region within this ...

Content controls have to be top-level controls in a content page or a nested master page that references a master page.
Why in the world am I getting this error? The solutions I have seen either don't apply or don't work.  Here is my master page code:<%@ Master Language="C#" AutoEventWireup="false" CodeFile="TechLMSMasters/MainSide.master.cs" Inherits="MainSide" %> <%@ Register TagPrefix="usercontrol" TagName="Search" Src="~/library/uc/Search.ascx" %> <%@ Register TagPrefix="usercontrol" TagName="UserName" Src="~/library/uc/UserNameDisplay.ascx" %><!DOCTYPE html PUBLI...

How do I control one control from another control?
I have a page page1.aspx which is within a master page. On page I have a table with two cells. Within each cell I have placed two controls (ascx) that I have developed. Now I'd like to be able to get these two controls to interact. One needs to update the other. One has some search criteria that the other one needs to update its gridview. One needs to make the other visible/not visible at certain times. Out of the box neither control can see each other at all. Is there a good article or someplace I can find some information on how to do this?  AllAboutFocus.com. Information Technolo...

Custom Control within a Control Control
I am developing a custom controls that will render headers for different web sites. Within these controls, I want to place another custom control that will change the language. I created the language control and had it implement IPostBackDataHandler. This control works fine if I drag it on a new web form, but if I tell a header custom control to render it problems occur. The Language Selector custom control does not have a Page member anymore and the event handlers do not work. Does anyone have any experience with doing something similiar? Anyone have any suggestions? Thanks, ...

Control.Value and Control.SelectedItem.Value
Can someone explain to me the difference between say, Dropdownlist.SelectedItem.Value and Dropdownlist.SelectedValue?? Just curious, Thanks!Tim These are going to return the same thing. dropdownlist.selectedvalue is a shortcut to get the currently selected value in the dropdown. If that is all you want then you can just use that. If you want to access the currently selected item you can use dropdownlist.selecteditem and that return the item and you can then access any of the item's properties, including in this case the value property. If this post answered your question please r...

controlling an object in a web control from the page the web control is placed in
I have created a web control in vb.net that has an image button and an image. when it loads the image button is visible and the image is not. I want to be able from the page which "includes" the web control to set the image button to invisible and the image to visible. When I tried this, the main page didn't recognise the image button or the image (both < asp: objects). help would be gratefully appreciated. oh yeah, it's inline code so any code behind stuff will just confuse me ;) Some code please.-- Justin Lovell...

i have 3 pages student information , i filled two pages ,then go to 3rd page . First Two pages iam having 100 controls.how to store that controls and how to send these controls into 3rd page in ?
i have 3 pages student information , i filled two pages ,then go to 3rd page . First Two pages iam having 100 controls.how to store that controls and how to send these controls into 3rd page in ?  There are a number of ways storing values. Check out: http://msdn2.microsoft.com/en-us/library/75x4ha6s.aspxhttp://www.csharphelp.com/archives/archive207.html Thanks,Karan~ Remember To Mark The Post(s) That Helped You As The ANSWER ~ Hi, Welcome to asp.net forums. Now as far as your requirements goes, the first thing that strikes me is that 100 controls are way too many to kee...

Page and Control Flashing Using AJAX Control Toolkit Controls
Page and Control Flashing Using AJAX Control Toolkit Controls I'm using IE7 and the ASP.NET AJAX Control Toolkit.  I'm using two controls -- Accordion and CollapsiblePanelExtender.  I'm actually using 2 CollapsiblePanelExtenders, and the Accordion control is inside one of the panels for the CollapsiblePanelExtender (see the code below). The problem I'm seeing is that when I click an Accordion pane to open/close it or click the CollapsiblePanelExtender panel to open/close the panels, the controls and page flash while the animation is in progess.  Everything el...

Web resources about - Menu control : Cross page posting and posted values in nested controls? - asp.net.navigation-controls

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Apple’s iOS 9.3 preview page hints at possible Control Center toggle to enable Night Shift
... If you head to the iOS 9.3 preview page on Apple Canada’s website , you can see that there’s an option to enable Night Shift from Control Center ...

#TBT: The Time Ad Age Went All-In for Gun Control
"Can there be any doubt anywhere that violence and contempt for law and order are doing their rotten best to tear American society apart? "Can ...

New Night Shift mode in iOS 9.3 could have its own Control Center toggle
In all likelihood, youll be able to toggle the new Night Shift mode in iOS 9.3 right from Control Center. It came from Canada At least thats ...

Simple free app alerts you when a program (or hacker) takes control of your webcam
... can take over your webcam without you knowing about it. That's right, malware, hackers or even government agencies like the NSA can take control ...

Cruz control: take a look at his puppet master
Cruz control by digby If you read nothing else today, read this Bloomberg article about Ted Cruz's top benefactor, the certifiably looney tunes ...

Run on Italy's Third Largest Bank? Capital Controls or Bail-Ins Next? Why Take Chances?
... "brilliant" comeback? Not a single fundamental problem with Italy, the ECB, the euro, or Europe in general has been fixed. Capital Controls ...

AlunaGeorge share "I'm In Control" ft. Popcaan
... last year to preview material off the followup to their 2013 debut Body Music, and now the first single is here. It's called "I'm In Control" ...

A guy made a remote control airplane using the fan from an old wall heater
... and old heater in his house when he realized that the blower motor inside of it could work a lot like a jet engine — so he made a remote control ...

3 Animal Control Workers Suspended After Dog Left In Van For 5 Days
Three Chicago Animal Care and Control workers responsible for leaving a dog in a van for five days have been suspended, even though the city’s ...

Resources last updated: 1/22/2016 2:48:21 AM