Text version of the video
http://csharp-video-tutorials.blogspo...
Slides
http://csharp-video-tutorials.blogspo...
All ASP .NET Text Articles
http://csharp-video-tutorials.blogspo...
All ASP .NET Slides
http://csharp-video-tutorials.blogspo...
ASP.NET Playlist
https://www.youtube.com/playlist?list...
All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenka...
All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatAr...
This is continuation to Part 147, please watch Part 147 before proceeding.
Let us understand how to pass data from a content page to a master page, with an example.
In the example below,
1. We have a textbox in the master page. The ID of the textbox is "txtBoxOnMasterPage"
2. On the Content page, we have another textbox and a Button. The ID of this textbox is "TextBox1" and the ID of the button is "Button1"
3. When you type some text in the textbox on the content page and when you hit "Set Text" button, we want to display the text entered in the textbox on the content page in the textbox that is present in the master page.
In the code-behind file of the master page, include a public property that returns the textbox control. Content pages will use this property to set the text of the textbox on the master page.
// The property returns a TextBox
public TextBox TextBoxOnMasterPage
{ get { // Return the textbox on the master page return this.txtBoxOnMasterPage; }
}
Retrieve the master page associated with the content page using Master property and typecast to the actual master page and then reference the property.
protected void Button1_Click(object sender, EventArgs e)
{ // Retrieve the master page associated with this content page using // Master property and typecast to the actual master page and then // reference the property ((Site)Master).TextBoxOnMasterPage.Text = TextBox1.Text;
}
If you want Master property to return a strongly typed reference of the associated master page, include the MasterType directive on the content page.
Once you have included the above MasterType directive on the content page, you will now have a strongly typed reference of the master page and can access it's properties without having to typecast.
protected void Button1_Click(object sender, EventArgs e)
{ Master.TextBoxOnMasterPage.Text = TextBox1.Text;
}
To retrieve a master page associated with a content page, we can use either
1. Master propery
2. Page.Master property
Page.Master property always returns an object of type "MasterPage" and we need to explicitly typecast it to the actual master page, if we need to access it's properties and methods, where as Master property returns a strongly typed reference of the actual master page if the content page has "MasterType" directive specified. Otherwise "Master" property works in the same way as "Page.Master" property.
asp.net core docker Part 148 Passing data from content page to master page in asp net | |
| 182 Likes | 182 Dislikes |
| 71,551 views views | 524K followers |
| Education | Upload TimePublished on 14 Oct 2013 |
Related keywords
wcf vs web api,ado.net core,sql server management studio,webkinz,webadvisor,craigslist nj,control mouse pad,wcf one piece,asp.net core 3,ajax players,weber grill parts,page name change,webtoon,tutorials by hugo,csharp corner,mvc design pattern,asp.net machine account,servers for minecraft,asp.net core dependency injection,ado.net tutorial,control techniques,control center,control sistem gereksinimleri,services angular,ajax ontario,asp.net mvc tutorial,asp.net cos'è,csharp assembly,tutorialspoint python,page turner,sql join,services briefcase,asp.net core web api,data entry,ajax jquery,wccftech,craigslist ny,data warehouse,asp.net zero,page 3,csharp foreach,page name,server memes,sql date format,services online,chase,serverless architecture,server resume,data science,wcf c#,server books,tutorialspoint javascript,mvcc connect,ado.net mysql,services technologies gps,data scientist,ajax deadpool,server jobs,cvs,website,controller,mvc tutorial,costco hours,wcf service application,control freak,tutorialspoint spring,serverless,wcf soap,wcf cat,wcf test client,cool math games,services & training hse colombia sas,servicestack,citibank,controller pc,asp.net core identity,sql union,ajax parking,sql database,asp.net core logging,page translator,mvconnect,asp.net guida,cunyfirst,wcf nba,csharp download,wcfi foundation,csharp online,control release date,wcf authentication,tutorials near me,http://asp.net,server 2019,ado.net descargar,web of dreams,chernobyl,serverminer,ajax cleaner,ado.net visual studio 2019,webassign,control fly,ado.net vs entity framework,data star trek,data lake,ado.net visual studio 2017,csharp list,sql like,asp.net mvc,asp.net core tutorial,sqlite,wcfm,ajax roster,page description,mvc architecture,http://ado.net,asp.net core mvc,ajax soccer,server hosting,data scientist salary,wcfi,ajax dish soap,capital one,server rack,tutorialspoint html,data mining,csharp interface,craigslist,control lyrics,webroot,control çıkış tarihi,tutorialspoint reactjs,ajax request,wcf dragon ball,asp.net core 2.2,tutorialspoint python 3,sql developer,webster,services transmission company sas,sql group by,asp.net core signalr,services manager,mvc framework,ajax paving,mvc near me,pageant,data analysis,control ps4,tutorialspoint spring boot,control panel,mvc map,csharp online compiler,asp.net download,sql between,data analyst salary,ado.net c# pdf,wcf 2019 nba,services tag dell,csharp switch,ado.net ventajas y desventajas,csharpstar,wcf tutorial,tutorialspoint,ajax meaning,csharp-video-tutorials.blogspot,tutorials dojo,csharp string format,central park 5,ado.net c#,asp.net core github,server status,ajax fc,server jobs nyc,asp.net core swagger,sql formatter,credit karma,services group,control gameplay,server error in '/' application,data entry jobs,services windows,asp.net core 3.0,sql injection,wcf ria services,tutorialspoint c#,calculator,ado.net entity data model,sql insert,data analytics,tutorialspoint tableau,services google play apk,sqlyog,asp.net core 3 release date,sql server,server job description,tutorials by a,servicenow,webcam,mvc hours,webmd symptom,csharp array,control panel türkçe,csharp enum,ajax call,asp.net core 2. guida completa per lo sviluppatore,asp.net core,server pro,server status ffxiv,webcrims,cheap flights,page border,asp.net core hosting,services sas,page manager apk,tutorialspoint java,tutorialspoint java compiler,datadog,webmd,page speed test,csharp to json,college football,ado.net dataset,csharp dictionary,cnn,website builder,tutorialspoint sql,asp.net web api,server side rendering,weber grills,sql server 2017,control steam,mvc nj,tutorialspoint spark,data breach,ado.net oracle,asp.net core download,csharp to vb.net,webster bank,page replacement algorithms,webstaurant,control epic games,datacamp,tutorialsystems,ajax post,services fms publish announcement,pagets disease,services.msc no abre,ajax jersey,csharp operator,asp.net core razor pages,server duties,asp.net core environment variables,csharp random,century 21,pager,services consultores,services consulting,mvcsd,mvcsc,services.msc,ado.net pdf,asp.net core configuration,ajax marvel,sql update,asp.net tutorial,mvc medical,control film,control halsey,ado.net entity data model visual studio 2019,wcfs international curriculum,mvc2,page cover photo size,ado.net entity data model visual studio 2017,chase online,wcf api,costco,server jobs near me,webex,sql meaning,sql tutorial,sql commands,page manager,paget brewster,page number in word,data universe,ado.net entity framework,ajax tavern,tutorialsteacher,ajax javascript,database,page game,services desk,page liker,data visualization,ajax greek,csharp tutorial,mvc pattern,ado.net sql server,ado.net connection,asp.net identity,mvcu,databricks,asp.net core middleware,data analyst,wcf web service,control union,mvc webadvisor,pageantry,web store,mvcc,webmail,mvci,mvctc,
Không có nhận xét nào:
Đăng nhận xét