Yes, it's pretty simple. You can 'find' the control from the content page. Here's a sample where i'm binding to a GridView control Master: asp:GridView runat="server" ID="gridViewMaster" AutoGenerateColumns="true Content Page: var gridView = (GridView) Master.
FindControl("gridViewMaster"); gridView. DataSource = dt; gridView.DataBind() Just replace the grid view object and control id with your repeater...and bind it to whatever object you want Edit - Here's the code to find a server side div: var divMaster = (System.Web.UI.HtmlControls. HtmlGenericControl)Master.
FindControl("divMaster"); divMaster. InnerHtml = ".
Yes, it's pretty simple. You can 'find' the control from the content page. Here's a sample where i'm binding to a GridView control.
Master: Content Page: var gridView = (GridView) Master. FindControl("gridViewMaster"); gridView. DataSource = dt; gridView.DataBind(); Just replace the grid view object and control id with your repeater...and bind it to whatever object you want.
Edit - Here's the code to find a server side div: var divMaster = (System.Web.UI.HtmlControls. HtmlGenericControl)Master. FindControl("divMaster"); divMaster.
InnerHtml = ".
Dear Ed B, really thanks. Is it possible to do this job for a server-side div? – MoonLight 2 days ago Yes, it works the same way.
Just add the div to the master. Then find it on the content page. I've added the code to find the server-side div above – Ed B 2 days ago I test that, I tried this > var SummaryContainer = Master.
FindControl("SummaryContainer"); SummaryContainer.DataBind(); but that div never shows me new results and I should click on a button in page for getting results. – MoonLight 2 days ago after your edit I test that again, still have no results! – MoonLight 2 days ago.
You can expose the master page control to the children. Make the control public with an accessor in the master page... such as: public Repeater MasterpageRptr {get;set;} Then on your child page, add the MasterType definition: (where MyMaster is the master page class file) Then you can call this in your child code-behide using the accessor. .. Please vote if helpful.
Thanks for help. Is it possible do this job for a server-side div? – MoonLight 2 days ago.
Yes. You have access to the master page from your web form—using this. Master—which you'd then have to cast as the appropriate type.
From there you can access any public methods or properties you've defined. Simple add a ReBind method there that does what you want, and you should be good to go. EDIT It would be something like: (this.
Master as WhateverTypeYourRealMasterPageIs).ReBind().
Thanks for all answers / would you please show me some codes! – MoonLight 2 days ago I added an edit for you – Adam Rackis 2 days ago thanks for edit, WhateverTypeYourRealMasterPageIs -> how can I found that? I tried (this.
Master as MasterPage).ReBind(); but have error! – MoonLight 2 days ago Go to the code behind of your master page. You should be able to see the class name there.
That's the type of the master page class. – Adam Rackis 2 days ago.
The proper way to do so is for the user control to fire an event that the Master page subscribes to. Let me know if you need some sample code Some sample code: In your user control, add the following event: public event EventHandler RefreshRequested; The user control will throw this event whenever it wants a refresh by calling the following method: private void OnRefreshRequested() { //make sure the event is being listened to. No point raising an event if no one cares!
If (this. RefreshRequested! = null) { this.
RefreshRequested(this, EventArgs. Empty); } } Now, the master page will subscribe to the user control's event and acts accordingly. Subscribing to the event is just like subscribing to any other event (ie: Button_Click).
Let me know if this clears things up.
Would be appreciate for show us some codes! – MoonLight 2 days ago thanks for edit your answer. – MoonLight 2 days ago.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.