Text version of the video
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
All ASP .NET Text Articles
All ASP .NET Slides
All Dot Net and SQL Server Tutorials in English
All Dot Net and SQL Server Tutorials in Arabic
In Part 55, we have discussed the basics of cross page posting. In the previous session, we used FindControl() method to get a reference to the TextBox on the previous page. The problem with FindControl() method is that, if we mis-spell the ID of the control, we don't get any compile time errors, but may cause runtime nullreference exceptions.
In this session, we will discuss about, obtaining a strongly types reference to the previous page. There are 2 ways to obtain a strongly typed reference. We will explore both of these options in this part of the video.
We will be using the same example used in Part 55. The first step in obtaining a strongly typed reference, is to create public properties. We want to convert the values of TextBox controls(txtName and txtEmail) into properties(Name and Email) respectively. The Name and Email properties are created as Read-Only properties, as we just need to read the values on the destination page.
So in short to obtain a strongly typed reference, there are 2 very simple steps.
First Step -- Create Public Properties (Read-Only is sufficient)
Second Step -- Obtain a strongly typed reference by Type Casting or by using the PreviousPageType directive.