Object to controltype?

  • Thread starter Thread starter Edwin Knoppert
  • Start date Start date
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?
 
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.
 
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
 
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..
 
Back
Top