|
-
Mar 10th, 2005, 03:32 AM
#1
Thread Starter
Hyperactive Member
Problem on inheriting from web form
Hi everybody,
I have made a web form class which I want to use as a base class for all data entry web forms. Following is the structure of the web form:
VB Code:
Public Class WFrmEnt
Inherits System.Web.UI.Page
Protected WithEvents nLast As System.Web.UI.WebControls.ImageButton
Protected WithEvents nNext As System.Web.UI.WebControls.ImageButton
Protected WithEvents nPrev As System.Web.UI.WebControls.ImageButton
Protected WithEvents nCancel As System.Web.UI.WebControls.Button
Protected WithEvents nSave As System.Web.UI.WebControls.Button
Protected WithEvents nMessage As System.Web.UI.WebControls.Label
Protected WithEvents nDelete As System.Web.UI.WebControls.Button
Protected WithEvents nModify As System.Web.UI.WebControls.Button
Protected WithEvents nAdd As System.Web.UI.WebControls.Button
Protected WithEvents nPrint As System.Web.UI.WebControls.Button
Protected WithEvents nFilter As System.Web.UI.WebControls.Button
Protected WithEvents nFirst As System.Web.UI.WebControls.ImageButton
Protected WithEvents nRemoveFilter As System.Web.UI.WebControls.Button
Private Sub nFirst_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles
nFirst.Click
Navigate(CNavAction.First)
End Sub
Private Sub nPrev_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles nPrev.Click
Navigate(CNavAction.Prev)
End Sub
Private Sub nNext_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles nNext.Click
Navigate(CNavAction.Next)
End Sub
Private Sub nLast_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles nLast.Click
Navigate(CNavAction.Last)
End Sub
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
MyBase.Render(writer)
End Sub
End Class
For making a data entry web form, I first add a new web form and place all the required controls on it including nAdd, nModify, nDelete, nFirst, nNext, nPrev, etc. After that, in the code behind page, I change the clause "Inherits System.Web.UI.Page" to "Inherits WFrmEnt". Everything works fine.
But my problem is that when I go to the designer screen of the web form, it inserts the declarations for the variables of the controls that are inherited from the base web form. It inserts the following code:
VB Code:
Protected WithEvents nLast As System.Web.UI.WebControls.ImageButton
Protected WithEvents nNext As System.Web.UI.WebControls.ImageButton
Protected WithEvents nPrev As System.Web.UI.WebControls.ImageButton
Protected WithEvents nCancel As System.Web.UI.WebControls.Button
Protected WithEvents nSave As System.Web.UI.WebControls.Button
Protected WithEvents nMessage As System.Web.UI.WebControls.Label
Protected WithEvents nDelete As System.Web.UI.WebControls.Button
Protected WithEvents nModify As System.Web.UI.WebControls.Button
Protected WithEvents nAdd As System.Web.UI.WebControls.Button
Protected WithEvents nPrint As System.Web.UI.WebControls.Button
Protected WithEvents nFilter As System.Web.UI.WebControls.Button
Protected WithEvents nFirst As System.Web.UI.WebControls.ImageButton
Protected WithEvents nRemoveFilter As System.Web.UI.WebControls.Button
However, this is not desirable because these declarations are already present in the base web form class. Is there a way to avoid this automatic insertion of undesired code?
It is easy when you know it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|