From the course: ASP.NET Web Forms Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Adding public properties to web controls

Adding public properties to web controls - ASP.NET Tutorial

From the course: ASP.NET Web Forms Essential Training

Start my 1-month free trial

Adding public properties to web controls

- [Instructor] So, in order to be able to communicate with this particular control, we'll need to add some properties to it. So we can go here, actually in the solution explorer we can go to the control itself, and we can go to the CS file, and here we can add some public properties. So if the property is marked as public, it means that the property itself would be made available to the outside world. So, let's do that. The first one we are creating, it's a property of type string, and we are going to call it, name, 'cause that was in the first one, and then the second one would be a public property. So let me do the same, prop, string, and then the name would be, message, and that would be the property that I have in here. Now when we do the page load, we can actually look inside here and get the information that we need. So one of the things, we need to do it here, if is post back. So in case that this is happening to be a post back, that it means that we want to read the…

Contents