asp menu control - c#

I'm working on an ASP app and I have an asp menu item
It shows the menu sub-items when the mouse is over but i'd like it to show the sub-items with a mouse click
What can I do?

It might be possible, but it is an extremely bad idea to do. You would have to modify the javascript completely.
Instead I highly recommend you to create your own menu control. You can get the SiteMap through the SiteMapDataSource.
SiteMap class
SiteMapDataSource class

Related

Add custom item to right click menu when user selects text

I want to add a custom menu item to the menu that appears when a user selects some text and right clicks. I searched a lot but did not get any answer. Maybe I did not put in the right keyword.
Is it possible to do this?
If this is possible, I want to do this for all applications in windows whenever the user selects text. Is there a universal way to do it or will have to write code specific to the application?
I am using C#.
I don't think you can do that universally in all windows apps. But it is certainly possible to do in your own app using a popup menu.
I've also tried a way to add an item to the standard ContextMenu and failed. From my point of view, the only solution is to set the TextBox's ContextMenuStrip property to an instance of the ContextMenuStrip class and implement both standard and your custom menu items. It is easy to mimic standard operation, since the TextBox class provides all required methods: Cut, Copy, Paste, SelectAll.
The universal way is basically writing a "custom shell extension".
There is an article on CodeProject about how to do this.
http://www.codeproject.com/Articles/174369/How-to-Write-Windows-Shell-Extension-with-NET-Lang
The other way to do this is to build this into your application. For example you might have a text editor and you'll want to highlight a word and get a definition for that word. To do this you'll need to implement a context menu.
The VERY BASIC concept is detailed over on CodeReview.StackExchange.
https://codereview.stackexchange.com/questions/3983/c-programatically-creating-context-menu

radiobuttons on windows phone applicationbar?

Hey guys I have this page :
PS: this is temp data, so it don't look so good ;P
Now if I click on that filter button, I want a popup window or radio buttons to show in the application bar, is that even possible? Or should I try another way of doing this?
As you choose a radio button I am going to have the page filter on the choice made, so I can't leave the page to go make a choice. Any help/link/tutorial will be appreciated :)
Thanks in advance,
Working on windows phone 8/ silverlight / c# ...
You can't have a radio button in the app bar.
I would implement this as a separate page and update your filter when you navigate back to this page. The page instance and view model will be still in memory so it should be a matter of detecting the back navigation in OnNavigatedTo and applying your filter at that point. Sharing a ViewModel between this page and your filter page would be the best way of communicating the filter value, but that's not the only way.

Need suggestion on Silverlight application

I am a beginner in silver light. I created a test application, in which on top there are menus like Home, About Us etc?? and there is a grid control to show content related to menu.
I created controls for Home, About Us etc, and I add this control on a click of associated menu. but I am looking for some generic way, rather than handling click of each menu separately, I also created a common click event, but the problem how can I get the Home COntrol or a About Us Control to add in a grid. In click event method I can get the clicked menu Information. I can write switch statement but it will also not called as a generic.
Something Like find a particular page/Control by its name in a whole silverlight application and add it to my grid.
Thanx!
Take a look at Ria Services and MEF. I'm currently on a Silverlight project and we are relying heavily on Ria Services and MEF. We are using a VMMV approach. It's working out nicely.
Silverlight has the Frame and Page controls to help you with some of these issues.
Check out:
http://msdn.microsoft.com/en-us/library/cc838245%28v=vs.95%29.aspx
This could be solved by using silverlight navigation, have a look at this blog and here
you can then do something like:
this.MainFrame.Navigate(new Uri("Page2.Xaml",UriKind.Relative));
// where page 2 is your page name taken from your menu item

ASP.NET Menu control changing position after postback

I am currently testing a menu in ASP.NET I've recently made using asp:menu control.
The menu is just as I want it to be right now, but whenever there is a postback that updates the whole page, it moves a little downwards (only once, a second postback won't move it a little bit more).
It's not CSS - > I've removed all CSS from this menu)
It's not any property -> I've commented out everything related to customizing the menu
It's not any other element above it enlarging -> I've specially put it inside a table, in which the only content is the asp:menu control
It moves a lot downwards in IE6, a little in IE8, and it doesn't move at all in Firefox 4.
What could I do ? Are there any alternatives ? Is there any property I can use, or any outer element I could put it inside in order for it to stay still ?
And yes, every single machine this is going to run in is using Internet Explorer. The nightmare of any web developer.
---[update]-----
I've built a menu in a separate project, and the effect wasn't there! I've copied the exact same files into my project, and ran it, and the issue was there.
Could it be a difference in the asp.net version ?
Did you check using IE web developer toolbar to see what's the html looks like in that area before and after the postback? It seems more like a browser issue so the toolbar would give you details as what is coming in the gap or may be what's pushing it down.
If the app is in asp.net 4.0, look at the source code of the page after it renders the first time, and then after the postback. Make sure it renders as divs on both or tables on both.
I currently have a similar issue where my menu "spreads out" on the postback. Before the postback, it renders divs. After the postback, it renders tables.
There is specifically a property on the menu "RenderingMode" which is suppose to control this, but it is not working for me.
I had the same problem. My navigation menu sits in an UpdatePanel, and I changed the UpdateMode from Always to Conditional - problem solved. This was in my master page.

How to incorporate jquery menu with asp.net membership

I am using Asp.net menu control for the web site that I am currently building and I am thinking to change to work with jQuery menu. So the current menu (Asp.net menu control) works with asp.net membership as many of knew.And the menu changed based on the role of the user who logged in. Is it possible to change the menu control to jQuery menu,with out affecting the membership functionality ?
Searching on "jQuery Menu," I did not see a specific jQuery menu -- there seem to be several available. Which are you using?
One possibility, though, is to use the CSS-friendly Menu Control Adapter. You can have ASP.NET output the menu as a much cleaner HTML list rather than a table, then use CSS and jQuery to get your client functionality. That way, the built-in Membership menu "pruning" will work and you have much more "style-able" and "jQuery-able" HTML in the page.
After looking at the Plugin
Looking at the HTML used for that menu plugin, I would certainly give the CSS-Friendly Menu Control Adapter a try. It generates nested Unordered Lists of the type that the plugin uses. It should work for you. ASP.NET will generate the menu items that match the permissions in the Membership DB, then you should be able to hook up the jQuery Menu plugin. The Menu Control Adapter wraps the list in a div, but the Menu Plugin can handle that (Example 3). If you need an easy way to find mangled ASP.NET control IDs client-side, I have found the :regex selector plugin to be very handy.

Categories