473,383 Members | 1,785 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,383 software developers and data experts.

Help in Web User controls ???

Dear all,
I try to study Web user control .For that I have created a simple text box
with button as a webuser control which has 2 properties.

Then I drop my user control on a web page for testing.
I have read that If we need to retrive Webuser control properties from the
web page, we need to place the code in the PAge_Prerender event of the form
which contains it.

So what I have do is that I place that webuser control on a web page called
WebPage1.aspx then on the pre_render event of that page I have place
following code :

dim sText as string
sText= myUserCtrl.getValue

Doing that return an error when executin about object not initiliaze. Then
when setting a break point on line above, effecively the myUserCtrl is nothing

So it is not fully loaded then

On which part can I retrive myuserCtrl properties value ?

thanks for your help
regards
serge
Nov 19 '05 #1
5 1286
did you set the textbox as Public in the control?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"serge calderara" wrote:
Dear all,
I try to study Web user control .For that I have created a simple text box
with button as a webuser control which has 2 properties.

Then I drop my user control on a web page for testing.
I have read that If we need to retrive Webuser control properties from the
web page, we need to place the code in the PAge_Prerender event of the form
which contains it.

So what I have do is that I place that webuser control on a web page called
WebPage1.aspx then on the pre_render event of that page I have place
following code :

dim sText as string
sText= myUserCtrl.getValue

Doing that return an error when executin about object not initiliaze. Then
when setting a break point on line above, effecively the myUserCtrl is nothing

So it is not fully loaded then

On which part can I retrive myuserCtrl properties value ?

thanks for your help
regards
serge

Nov 19 '05 #2
What do you mean by that ?

I simply drop a textbox control on my webuser control in design mode, then
create public properties as follow :

Public Property GetValue() As String
Get
Return ViewState("value")
End Get
Set(ByVal Value As String)
ViewState("value") = Value

End Set

Then somewhere on my webcontrol code I set :
ViewState("value")=mytxtBox.text

thanks
"Curt_C [MVP]" wrote:
did you set the textbox as Public in the control?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"serge calderara" wrote:
Dear all,
I try to study Web user control .For that I have created a simple text box
with button as a webuser control which has 2 properties.

Then I drop my user control on a web page for testing.
I have read that If we need to retrive Webuser control properties from the
web page, we need to place the code in the PAge_Prerender event of the form
which contains it.

So what I have do is that I place that webuser control on a web page called
WebPage1.aspx then on the pre_render event of that page I have place
following code :

dim sText as string
sText= myUserCtrl.getValue

Doing that return an error when executin about object not initiliaze. Then
when setting a break point on line above, effecively the myUserCtrl is nothing

So it is not fully loaded then

On which part can I retrive myuserCtrl properties value ?

thanks for your help
regards
serge

Nov 19 '05 #3
ok... then on your page declare the UserControl and access the TextBox

Dim userControl1 as YourUserControl
Dim strSomeText as String = userControl1.GetValue

Although you dont need the GetValue(), you could just call the .Text
property directly if the TextBox is declared Public

Dim userControl1 as YourUserControl
Dim strSomeText as String = userControl1.YourTexBox.Text
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"serge calderara" wrote:
What do you mean by that ?

I simply drop a textbox control on my webuser control in design mode, then
create public properties as follow :

Public Property GetValue() As String
Get
Return ViewState("value")
End Get
Set(ByVal Value As String)
ViewState("value") = Value

End Set

Then somewhere on my webcontrol code I set :
ViewState("value")=mytxtBox.text

thanks
"Curt_C [MVP]" wrote:
did you set the textbox as Public in the control?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"serge calderara" wrote:
Dear all,
I try to study Web user control .For that I have created a simple text box
with button as a webuser control which has 2 properties.

Then I drop my user control on a web page for testing.
I have read that If we need to retrive Webuser control properties from the
web page, we need to place the code in the PAge_Prerender event of the form
which contains it.

So what I have do is that I place that webuser control on a web page called
WebPage1.aspx then on the pre_render event of that page I have place
following code :

dim sText as string
sText= myUserCtrl.getValue

Doing that return an error when executin about object not initiliaze. Then
when setting a break point on line above, effecively the myUserCtrl is nothing

So it is not fully loaded then

On which part can I retrive myuserCtrl properties value ?

thanks for your help
regards
serge

Nov 19 '05 #4
This is what I have done.

In which palce in the page should I call my control property ?

If I place it in Page_load event, it fails cause the control is not yet
fully loaded
I read in ms press books that the controls gets loaded at the end of the
page_load event

how to do then ?

regards
serge
"Curt_C [MVP]" wrote:
ok... then on your page declare the UserControl and access the TextBox

Dim userControl1 as YourUserControl
Dim strSomeText as String = userControl1.GetValue

Although you dont need the GetValue(), you could just call the .Text
property directly if the TextBox is declared Public

Dim userControl1 as YourUserControl
Dim strSomeText as String = userControl1.YourTexBox.Text
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"serge calderara" wrote:
What do you mean by that ?

I simply drop a textbox control on my webuser control in design mode, then
create public properties as follow :

Public Property GetValue() As String
Get
Return ViewState("value")
End Get
Set(ByVal Value As String)
ViewState("value") = Value

End Set

Then somewhere on my webcontrol code I set :
ViewState("value")=mytxtBox.text

thanks
"Curt_C [MVP]" wrote:
did you set the textbox as Public in the control?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"serge calderara" wrote:

> Dear all,
> I try to study Web user control .For that I have created a simple text box
> with button as a webuser control which has 2 properties.
>
> Then I drop my user control on a web page for testing.
> I have read that If we need to retrive Webuser control properties from the
> web page, we need to place the code in the PAge_Prerender event of the form
> which contains it.
>
> So what I have do is that I place that webuser control on a web page called
> WebPage1.aspx then on the pre_render event of that page I have place
> following code :
>
> dim sText as string
> sText= myUserCtrl.getValue
>
> Doing that return an error when executin about object not initiliaze. Then
> when setting a break point on line above, effecively the myUserCtrl is nothing
>
> So it is not fully loaded then
>
> On which part can I retrive myuserCtrl properties value ?
>
> thanks for your help
> regards
> serge
>
>

Nov 19 '05 #5
As for where in your code...
Are you trying to read or write to the textbox? If you are trying to read it
you will want to wait till it's populated and they do something to PostBack,
in which case you can do it in the Load or the individual event (Button
Click?) that causes the postback.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"serge calderara" wrote:
This is what I have done.

In which palce in the page should I call my control property ?

If I place it in Page_load event, it fails cause the control is not yet
fully loaded
I read in ms press books that the controls gets loaded at the end of the
page_load event

how to do then ?

regards
serge
"Curt_C [MVP]" wrote:
ok... then on your page declare the UserControl and access the TextBox

Dim userControl1 as YourUserControl
Dim strSomeText as String = userControl1.GetValue

Although you dont need the GetValue(), you could just call the .Text
property directly if the TextBox is declared Public

Dim userControl1 as YourUserControl
Dim strSomeText as String = userControl1.YourTexBox.Text
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"serge calderara" wrote:
What do you mean by that ?

I simply drop a textbox control on my webuser control in design mode, then
create public properties as follow :

Public Property GetValue() As String
Get
Return ViewState("value")
End Get
Set(ByVal Value As String)
ViewState("value") = Value

End Set

Then somewhere on my webcontrol code I set :
ViewState("value")=mytxtBox.text

thanks
"Curt_C [MVP]" wrote:

> did you set the textbox as Public in the control?
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>
>
>
> "serge calderara" wrote:
>
> > Dear all,
> > I try to study Web user control .For that I have created a simple text box
> > with button as a webuser control which has 2 properties.
> >
> > Then I drop my user control on a web page for testing.
> > I have read that If we need to retrive Webuser control properties from the
> > web page, we need to place the code in the PAge_Prerender event of the form
> > which contains it.
> >
> > So what I have do is that I place that webuser control on a web page called
> > WebPage1.aspx then on the pre_render event of that page I have place
> > following code :
> >
> > dim sText as string
> > sText= myUserCtrl.getValue
> >
> > Doing that return an error when executin about object not initiliaze. Then
> > when setting a break point on line above, effecively the myUserCtrl is nothing
> >
> > So it is not fully loaded then
> >
> > On which part can I retrive myuserCtrl properties value ?
> >
> > thanks for your help
> > regards
> > serge
> >
> >

Nov 19 '05 #6

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

Similar topics

4
by: Mike | last post by:
Please help this is driving me nuts. I have 2 forms, 1 user class and I am trying to implement a singleton class. Form 1 should create a user object and populate some properties in user. Form2...
2
by: mark | last post by:
I've been working on an Access 2000 database for a couple of weeks now. I took a course in access about a year ago, a crash course, and I learned a ton, but I didn't touch Access for the year since...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
5
by: MFC | last post by:
Ok, after three C# books, (C# How to Program, Programming in the Key of C#, and C# Weekend Crash Course) and three weeks, I believe I have tried everything to make a certain form function...
3
by: Navin | last post by:
Hello friends... On a single asp.net web page i have a single server-side form that contains a couple of user-controls. Each user control has its own functionality and contains server-side textbox...
2
by: paul meaney | last post by:
All, myself and another developer have been staring blankly at a screen for the past 48 hours and are wondering just what stunningly obvious thing we are missing. We are trying to load up 2...
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...
2
by: Peter Jackson | last post by:
I'm using v2 of the UIP App. Block. I've created all my .aspx pages, all of which contain .ascx user controls. The .ascx user controls provide the standard server controls (i.e., LinkButtons, etc.)...
3
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
0
by: Mike Collins | last post by:
I someone can please help, I am about at an end in trying to figure this out. I am adding some dynamic controls to my page (I found out that I was supposed to be doing that in the oninit event,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.