How to launch XAML page across the pages? - c#

I am developing a Windows Phone 7 application. My requirement is to create side menu control which is similar to facebook side menu. My application has 10 XAML pages. I want to use this side menu control in all of my pages. I don't want to copy paste the code in all the 10 pages. Instead i am preferring to create a global XAML page and use across the pages. If i click the side menu, it should open like facebook side menu in all of my 10 XAML pages. I am having the source code in which the control is used in only one page. But i want to use the control globally. Any help appreciated.

You can either extract side menu ability in a separate user control and then simply use that user control on every page or you can create a page that acts as a frame around user controls.
In the former case, you need to copy/paste a few lines of code on every page you have to add the side control. In the latter case you must do the following:
- create a master page which contains a side control and has an empty space for the page's content
- instead of writing pages, write user controls and load them inside the master page
- when navigating, simply reload the content in the middle.
The latter case gives you full control, but you develop your applications differently.

Related

How to create the below model drop down in asp.net using C#

I am just learning .net and i wonder if it is possible to create drop lists like the one shown above or having a list type item where if + is pressed the item is expanded and when - is pressed again it minimizes.
!
Thank you
You can try using:
1 . ASP.Net Ajax Accordion Control
The Accordion is a web control that allows you to provide multiple panes and display them one at a time. It is like having several CollapsiblePanels where only one can be expanded at a time. The Accordion is implemented as a web control that contains AccordionPane web controls. Each AccordionPane control has a template for its Header and its Content. We keep track of the selected pane so it stays visible across postbacks.
2 . ASP.Net MultiView Controls
The MultiView and View Web server controls act as containers for other controls and markup, and provide a way for you to easily present alternate views of information.
You can use the MultiView and View controls to perform tasks such as the following:
Provide alternate sets of controls based on user choice or other conditions. For example, you might allow users to select from a list of feeds, each of which is configured in a separate View control. You can then display the View control that contains the user's choice of feeds. You can use the MultiView and View controls as an alternative to creating multiple Panel controls.
Create a multi-page form. The MultiView and View controls can provide behavior that is similar to the Wizard control. The Wizard control is particularly suited to creating forms that users fill in step by step. The Wizard control also includes support for more built-in UI elements, such as a header and footer, for Previous and Next buttons, and for templates. You might use a MultiView control in place of a Wizard if you wanted to create a display that changed based on condition (rather than sequentially), or if you did not need the extra features supported by the Wizard control.
You should read about TreeView Structure.
Read this
You could do it in your code behind, but I would suggest looking into using a jQuery plugin for this. Dependent on which one you want, you will just need to render the contents, then have the plugin make it pretty :)
I always like using : http://jquery.bassistance.de/treeview/demo/

Can you force a Page Render after it's loaded

Problem:
I am loading one of several user controls based on a selected tab within RadTabstrip Control which is on the parent page. I've captured the Selected Tab and assigned it to a Session variable within the OnTabClick event to use in each User Control to determine if that particular control needs to be rendered.
The reason for this is because each User Control queries a database to render different charts and I don't want unneccesary processing occuring on every post back to the server. I'd like to add that each User Control has several Labels in their Markup that only gets the Text values assigned during runtime based on the content retrieved from the database.
When I load the main page, the selected tab variable is checked by each User Control and everything works fine from that scope. (The first tab at index 0 has no Charts)
Problem is when I select a Tab which has a User Control, the appropriate code to acquire the data from the database and build the chart works fine but the TEXT value of the Label controls in the Markup don't show up on the Page, although the TEXT values are being set in the Code-Behind at the same time the data is being retreived.
If I perform a Post Back of the same page, the TEXT values of the Label controls appear.
I believe this is because the 1st stages of the Page Life Cycle which include the rendering of the Markup aren't firing on the initial loading of the User Control, but get fired on subsequent Reloads or Refreshes of the Page.
Is there a way to work around this? I am figuring a call to the Render event after hitting the database would work but I may be way off base on my thoughts.
Can anybody provide some advice or a potential solution???
Thanks
I was never able to resolve the late binding issue which prevented the text of the labels from appearing until after a manual refresh of my page so I approached the issue from a different angle. I still retained the logic that only allowed the data of each User Control to get populated if their corresponding Tabs were selected by the user, but I moved the in-line code which was embedded in my Markup to my Code-Behind file.
I was not 100% certain as to the order that the mark-up vs. the code-behind got processed, so I researched and found that anything done declaratively in the aspx page is processed first, and the objects are created before being accessed or updated in the code behind.
So with this information I totally separated the two and was able to get the Text to render on the labels without any issue.
I still would haved liked to have known the appropriate way to force a page to call the Render event to simulate or mimick a manual Postback after the initial Page_Load, but going with the flow of the Page Cycle is the much easier and probably a more preferable way to do things.
One way to approach your problem is to consider use of the "Update Panel". It will allow you to render the entire page and then on an event only refresh the area of the update panel.
Generally I would love this feature for performance reasons but there is a catch. Some browsers (e.g. versions of Safari and Opera) do not render these correctly. Is your application a web application intended for general use by consumers? If so you may need to consider a full page refresh on the same page and pass the user data (unless Opera / other browsers have fixed this shortcoming - I have not tested in in 4 months).

Asp.net user control changing language on texts

I'm working on a asp.net website and I have created a user control where I've placed a menu to be used on the master page. Now I want to be able to change the language on each menu item by using a resource file. How do I change this on a user control? I've worked it out on a regular aspx-page but ascx workes different as it derives from System.Web.UI.UserControl.
How did you do it on the aspx page? You can go into design mode, select generate local resources and the resx file will be generated for you. For User Controls it works the same way as for ASP.NET web forms.

Display Sharepoint Webpart as a PopUp

I need to display SharePoint WebPart in a PopUp.
Is there a way to do it?
You can also create a regular web part page, but base it on an empty master page, the result will be the same, but more customizable.
You can also maybe use a hidden DIV with a web part zone, if you need an overlay section and don't care if it's not an actual window
Create a custom application page (in _layouts) without any menu or navigation, then add a webpart into it and open that page as your popup.

Effectivly creating a tabbed website with RadTabStrip

I have an ASP.NET web application that I am making and I am thinking of making it a tabbed interface using Telerik's RadTabStrip. I am trying to figure out the best way to approach this though. I would need about 10 tabs because I have about 10 different main areas of my application. My question is how is the best way to integrate the content into the tabs. All of the simple examples I've seen create RadViews with imbedded HTML/ASP.NET content. The problem with this approach is that, with 10 tabs, it would make my main ASPX file really really big and it would be kind of clumsy to work with, having to integrate all 10 pages into one page. Is there a better or more accepted way to accomplish this?
I think, you have several possibilities:
Use one RadTabStrip and several RadView controls. Put the content for each tab into a separate user control (*.ascx). Then you only have to include the user controls in your main aspx page.
Use a master page and put the RadTabStrip on it. Create a separate page for each area of your application (each using the same master page). Use the RadTab's NavigateUrl property to navigate to the corresponding page (as shown in this demo).
there are certainly other possibilities...

Categories

Resources