Use Control Inherits From StrataFrame Library


Author
Message
Wang Tong Yin
Wang Tong Yin
StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)
Group: Forum Members
Posts: 25, Visits: 46
Can I use my own control, which inherits from StrataFrame library? For example, I define a class called 'Textbox' as below:

Public Class Textbox

     Inherits MicroFour.StrataFrame.UI.Web.TextBox

     .

     .

     .

End Class

 

Will it cause any errors when i try to add, update or delete record?


StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Nope, no problems at all... have fun with that.

Also, if you need to create your own controls that are bindable to business objects in the framework, you only need to implement the IWebBusinessBindable interface on your control and use the source code for the TextBox or any of the other controls to see how to implement it (type editor attributes, extra code, etc.).

Wang Tong Yin
Wang Tong Yin
StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)
Group: Forum Members
Posts: 25, Visits: 46
I try to change something on the web controls before displaying them. For example, the value of a textbox will be updated by a function before it shows out. Can I add my code in some event functions like Textbox_Init() and Textbox_Load() as shown below?

Private Sub Textbox_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

End Sub

Private Sub Textbox_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Will it affect the original behavior of strataframe control? Does Strataframe add any code in event functions? Is there any better way to do it? Does Strataframe provide any hook method like before display, after display?

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
No, the web controls do not have any hooks for the databinding.

The data is copied through the binding to the control on the Page.PreRender event and the data is copied back from the control on a PostBack through the Page.PreLoad event.  So, after the PreRender event, the controls will be populated with the appropriate values for the binding, and successfully modify the value by altering the control after the Page.PreRender event.  Same thing goes for the Page.PreLoad event for copying data back from the control.

Wang Tong Yin
Wang Tong Yin
StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)
Group: Forum Members
Posts: 25, Visits: 46
1. This means StrataFrame will update and modify the value of the controls in Page.PreLoad and Page.PreRender event?

2. What will happen if I add code in Page.PreLoad and Page.PreRender event? If error may occur, what I should do to prevent the error?

3. Page.Load and Page.PreRenderComplete are the safe places for me to add some codes?

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
This means StrataFrame will update and modify the value of the controls in Page.PreLoad and Page.PreRender event?

That is correct.

What will happen if I add code in Page.PreLoad and Page.PreRender event? If error may occur, what I should do to prevent the error?

You could add code there.  You should handle errors just like any other errors that appear within an ASP.NET page, including the custom error pages if necessary.

Page.Load and Page.PreRenderComplete are the safe places for me to add some codes?

Correct, those are the safest places to add code.

Wang Tong Yin
Wang Tong Yin
StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)StrataFrame Beginner (27 reputation)
Group: Forum Members
Posts: 25, Visits: 46
In foxpro we can use DODEFAULT() function to execute parent event or method. This can prevent child class from overwriting the codes in parent class. How to do this in VB.Net?
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
When you override a method, you have to call MyBase.MethodName().  So, if you're overriding the OnPaint() method of a control, it would look like this:

Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
    '-- Make the base method call (DODEFAULT())
    MyBase.OnPaint(e)

    '-- Custom code here
End Sub

Now, if you attach to an event, then there is no base or DODEFAULT that you need to call; it will be done automatically.  In fact, there is no way to prevent the base methods from firing.  Only on method overrides do you need to call the base method.


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search