StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Use Control Inherits From StrataFrame Library...Expand / Collapse
Author
Message
Posted 07/03/2006 9:51:53 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 07/18/2006 7:59:33 PM
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?

Post #1710
Posted 07/03/2006 10:08:41 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/02/2008 4:42:46 PM
Posts: 2,686, Visits: 1,890
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.).


www.bungie.net
Post #1711
Posted 07/04/2006 1:15:04 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 07/18/2006 7:59:33 PM
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?

Post #1718
Posted 07/05/2006 9:17:41 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/02/2008 4:42:46 PM
Posts: 2,686, Visits: 1,890
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.


www.bungie.net
Post #1724
Posted 07/06/2006 8:03:11 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 07/18/2006 7:59:33 PM
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?

Post #1730
Posted 07/06/2006 8:49:17 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/02/2008 4:42:46 PM
Posts: 2,686, Visits: 1,890
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.


www.bungie.net
Post #1733
Posted 07/06/2006 10:28:43 PM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 07/18/2006 7:59:33 PM
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?
Post #1763
Posted 07/07/2006 9:07:41 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/02/2008 4:42:46 PM
Posts: 2,686, Visits: 1,890
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.




www.bungie.net
Post #1765
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 1:42am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.078. 15 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.