How to display aspx page inside a Panel/View? - c#

So I have my main page with buttons on top of it.
Below there's a MultiView (also tried with a Panel) and I want to display a different page (aspx) inside it when a user clicks the button on top of the page.
I've been trying to do this for 2 hours now and can't get this to work... No good info # Google.
Thanks in advance...

Try user controls instead of pages. I am not aware of any case where I ever needed this functionality.
Beside that, I'm rather sure that it is not supported to insert pages into other pages.

Related

finding master page control from another master page?

I am using two Different master page in my site. On one master page i am using a LoginStatus control. So wanna access that LoginStatus control from other. I have no great knowledge about how to find the controls from one master page to other.
Is there any way to achieving this. Any help is deeply appreciated.
Thanks.
Well if there is single master page and content page you can access control using
Label lblinMaster = (Label)This.Master.FindControl("Label1");
and the same way to access control in nested master page you can use following.
Label lblinParentMaster = (Label)Master.Master.FindControl("Label1");
Hope this helps.
Unless you are using nested master pages, you cannot access one master page from another.
A Page would normally use only one master page at a time.
The users login status, however is not dependent on the LoginStatus control.
You can show this status everywhere.
Refer: ASP.NET Login Controls to get an idea about the right control to use.

Load contents to an ajax tab when the user clicks on it

I have a page(C#-asp.net application) with more than 5 ajax tabs that gets data on page load. Since it takes a long time, i want to populate the tab contents only when the user clicks on the tab.not able to find any event in tab panel. BTW i'm using an AJAX Tab container Please Advice me ASAP.
Thanks in Advance. :)
You need to set AutoPostBack="true" add ActiveTabChanged to tab control. For details go here
Consider to extract tabs content to user controls and load them into active tab in Page_Load method depending on ActiveTabIndex property

Do I need more than one master page for my case?

I have two types of pages .. the first is a display list and the second is a form to collect data.
I used a master page with two panels and each panel contains a ContentPlaceHolder .. the first contenet holder will show the input controls and the second one will show a unique message for every page after the user submit his data.
This is sort of a web moderator panel, where he'll add and display the items in the system to manage the website.
Now the problem is the second type of pages isn't related to the first type (Collecting data page) in the content area but it will share the same main menu and side menu!
so do I use two MasterPages and repeat the markup of the Main Menu and the Side Menu ? or can I use a base master page and the 2 master will inherit from it or what!!
I'm really confused on how to achieve this without breaking the good design concepts..
You can create a master page that has all the main layout information. Then have two sub master pages that inherit the main master page. These pages would just have minimal markup and inherit most of their layout / etc from the main master page

getting some problem with gridview paging

I have two pages.
In one page I have placed a GridView. In the grid I am using two hyperlinks for select and edit. When I click for the edit page I am redirected to another page. When I have finished editing the record it goes back to the first page.
The problem is when I was on the 2nd or 3rd page of the GridView and then edited, it went back to first page, not the 2nd or 3rd page I was on.
I want the same page after I go back to the page I left. How can I go about this?
The problem is that the webpage needs to know what page to send you to. The way I do this is to pass a querystring parameter when I change pages.
So in the URL to the edit page you want to have the URL say (for example) http://server/edit.aspx?value=number&returnPage=2 and then when you go back to the grid page you'll pass the page value like http://server/grid.aspx?page=2
This way you'll always know what page to tell the GridView to goto. And it should be pretty easy to add in depending on your level of comfort with the Params object.
Response.Redirect("einward.aspx");
you have to redirect to the page, wtever page u want.

Loading & Retrieving data from multiple user controls

I have multiple user controls on the page that are used primarily for data entry purposes. When a product is loaded, I need to load the product data into all those user controls and retrieve data when I need to save the product. The user controls are not visible to the user directly, instead user would click on a link and the user control will open up in a modal popup.
Currently the way I'm doing this is, I've loaded all the user controls on the page in separate div controls, and showing the modal popup when the link is clicked. I'm sure loading all the user controls on the page is not a good idea. Is there a better way to handle this? I think we can show the markup using JSON with jQuery - but how can I load and retrieve the data using that? Can someone help please?
Thanks.
Sounds like a case for AJAX. You could use an UpdatePanel within the div that defines the modal dialog. From the click handler for whatever control brings up a particular modal, you can dynamically replace one usercontrol with another in that UpdatePanel, pre-populate the usercontrol's data, then show a single modal that could be anything. Doesn't have to be a modal either; you could set up the UI with tab-like controls that switch between these UserControls in an always-visible div.
For a simpler approach, you could keep your Usercontrols in a div that is initially hidden by JQuery.
On postback, ie. when the user clicks the button/link for a particular product you can populate all your controls in a standard ASP.Net way so they're ready to display and then call a bit of JS/JQuery to show the div as a modal dialog.

Categories