473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

User Control question - REPOSTED

I am using framework 1.1

I have a user control and a web page.

I want to set up properties on the user control, so I can access the text
boxes on the user control when I am in the code behind page of the 'main'
web page.

I have done this so far...
1) On the user control... in the #Region " Web Form Designer Generated Code
" I have 2 text boxes (for simplicity of this question). If I am on the
main web page and I want to access the text boxes on the user control, I
have to change the defenition of the text box from Protected WithEvents to
Protected Shared WithEvents. Then I create the property like this in the
user control...

Public Class AccountCenterGeneral
Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub

Protected Shared WithEvents txtSalesTaxPercent As
System.Web.UI.WebControls.TextBox
Protected WithEvents txtNotes As System.Web.UI.WebControls.TextBox
#End Region

Public Property Notes() As String
Get
Return txtNotes.Text
End Get

Set(ByVal Value As String)
txtNotes.Text = Value
End Set
End Property

2) In the main web page, I can then code this to access the text box

dim tempString as string
tempString = AccountCenterGeneral.Notes (AccountCenterGeneral is the
name of my class in the user control)

THE PROBLEM... often times, if I make a change to the user control, ALL of
my definitions for the controls get changed back to Protected WithEvents
automatically and I have to reset them to Protected Shared WithEvents. So
I'm wondering if I am doing this all wrong, or if I should go back to using
this type of code... (can anyone explain which way is better)?

dim tempString as string
Dim currentTextBox As TextBox
currentTextBox =
Page.FindControl("AccountCenterGeneral1").FindCont rol("txtInterestRate")
tempString = currentTextBox.Text

Thanks in advance! Brian

May 2 '06 #1
0 957

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Randy Birch | last post by:
Reposted as the original is reported as deleted from the server. re: MSComCtl Listview control cashes after installing VB6/VS6 SP6 I have been advised that this problem has been reproduced...
0
by: Eric Giguere | last post by:
Back in August of 1990 I posted to the comp.std.c newsgroup a document I had written entitled "The ANSI Standard: A Summary for the C Programmer". I have converted it to HTML and reposted it as a...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
5
by: J'son | last post by:
<REPOSTED> Guys, I need to build a web intranet application that can automatically create a user account when a new user registers on the site. The user account will be on the web server,...
2
by: David | last post by:
Is there any known defects with respect to Databinding to a ComboBox that is located on a UserForm? I have a scenario on one of my forms that I have spent HOURS trying to solve that has...
0
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
3
by: =?Utf-8?B?QnJpYW4gTmljaG9sc29u?= | last post by:
Hello, I'm trying to create an admin page that can run miscellaneous scripts for our IT department. Currently, I'm trying to create a script that can map a network drive for a user (e.g. a form...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.