Object to controltype?

E

Edwin Knoppert

I wonder how i can get rid of the warnings.
I pass one control as object to a procedure.
However, the controltype differs per scenario, therefore i choose for AS
object.

I want to set a style in this procedure like:
mycontrol.Attributes.Add("style", "DISPLAY: none;")

It works fine, but i wanted to convert to a webcontrol or similar to get rid
of the warnings.

Hopefully i don't have to use another param for type?
 
E

Edwin Knoppert

I read about session which expires and then they want to jump to login page.

That's not the problem for me imo.
Since the login remains authenticated.

The problem is that variables are lost and i want to jump to the default
page instead of the login.
(Why login?)

I'm using
Application_AuthenticateRequest() in the global asax to check on each
request.
Maybe i can change my code little in here to:
Continue somehow or jump to the default page.
 
A

Andy

You could overload the method so that it takes either kind of control.
Alternately, you could use GetType (or in C# typeof) to get the type
and modify your code according to the type.

If both controls share a common base, you could have the method take
the base, but it doesn't sound like they do from your comments.

HTH
Andy
 
E

Edwin Knoppert

That seems complicated, i'm using the VB part :)
I'm passing the control and i alreadt tried GetType() on the OBJECT var.
This is not allowed.
(Type not defined)

Since this param can be nothing also..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top