Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Finding object from ID

Reply
Thread Tools

Finding object from ID

 
 
Søren Reinke
Guest
Posts: n/a
 
      10-10-2005
Hi there

I am trying to create the following server control.

My control has 3 stages, where it show 1 of 3 images, as parameter is gets
1-3 ID's of validators on the aspx page.

States:
1. No required validators, show an empty image
2. One or more validator was invalid, show a red arrow image
3. All validators are valid show green arrow image.

(the control just returns '<img src="red.gif" />'

My problem is, in the aspx page i have:
<cc1:ValidationPicture ID="ValidationPicture1" runat="server"
Validator1="cityRequiredFieldValidator"
Validator2="cityRegularExpressionValidator"/>

My method in the DLL get's called correctly, but how do i get from the ID af
a validator 'cityRegularExpressionValidator' to the object ? So i can call
'isValid()' on it ?

I tried with:

obj=Page.FindControl(ID)

and

obj=FindControl(ID)

Put the first one fails because 'Page' is null/nothing the other one always
returns null/nothing.

I have tried to google it, but no luck How do the validators do it ? The
also just get an ID and evaluate the objects content.

Please help me, an example would be nice, if does not matter if it is in VB
or C#

--
Best regards C.T.O. Søren Reinke
www.Xray-Mag.com/ - Your free diving magazin on the net. Download it in PDF
BALI :: Polluce Wreck: A tale of treasures lost and found. SALT
(mini-theme):
The Salty Oceans - Survive on Seawater? - Mangroves


 
Reply With Quote
 
 
 
 
Søren Reinke
Guest
Posts: n/a
 
      10-11-2005

"Peter Blum" <> wrote in message
news:...
> Hi Søren,
>
> The FindControl method searches only controls in the same "naming
> container" of the object that method is called on. If you call
> Page.FindControl, it searches the Page naming container, but nothing it
> contains that implements INamingContainer, like a UserControl or row of a
> DataGrid. It sounds like your validators are in different naming
> containers.


Thanks for the tips

What i actually was doing was that i tried to get to the Page object before
it existed (in the get/set methods), of course i should do it in the render
method instead and now it works.

--
Best regards C.T.O. Søren Reinke
www.Xray-Mag.com/ - Your free diving magazin on the net. Download it in PDF
BALI :: Polluce Wreck: A tale of treasures lost and found. SALT
(mini-theme):
The Salty Oceans - Survive on Seawater? - Mangroves


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding Server... Finding Host.... enough already!!! Leesa_Tay@softhome.net Computer Support 2 01-20-2006 10:23 AM
finding out weather an object extends a certain class hgwoss@gmx.de Java 4 11-24-2005 12:35 PM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
Re: Finding the object that fired the Event Karl ASP .Net 0 08-30-2004 08:06 PM
Finding information in an Image object George Smith Java 1 02-24-2004 09:40 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57