Cross page postback strongly typed reference Part 56

  • دعنا نشارك هذا :
ترتيب الدرس : 56
المدة : 00:11:07
التحكم :
Text version of the video
http://csharp-video-tutorials.blogspot.com/2012/11/cross-page-postback-strongly-typed.html

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.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation1

Slides
http://csharp-video-tutorials.blogspot.com/2013/08/part-56-cross-page-posting-in-aspnet.html

All ASP .NET Text Articles
http://csharp-video-tutorials.blogspot.com/p/free-aspnet-video-tutorial.html

All ASP .NET Slides
http://csharp-video-tutorials.blogspot.com/p/aspnet-slides.html

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenkat/playlists?view1&sortdd

All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatArabic/playlists

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.

سيتم تفعيل التعليقات قريبا

y
Sep 23, 2020 07:32:24
youtube