Re: 'Specified Cast Is Not Valid' Error!

Discussion in 'ASP .Net' started by Stefan Landgraf, Aug 19, 2003.

  1. you have to cast to the correct type:

    View IngView = (TypeOfIngView) (Page.LoadControl("../UserControls/IngView.ascx"))

    where TypeOfIngView is the type of your control

    Regards
    Stefan Landgraf


    "John" <> schrieb im Newsbeitrag news:%...
    > Hi all,
    >
    > I'm receiving the error in the subject heading when I try to add a user
    > control into a placeholder.
    >
    > The sub this is happening in, serves as a toggle between loading one of two
    > different user controls into the placeholder. The source is as follows:
    > plcMain.Controls.Clear()
    >
    > IngView = (Page.LoadControl("../UserControls/IngView.ascx"))
    >
    > plcMain.Controls.Add(IngView) ----------> Error here
    >
    > How do I avoid this (and please don't recommend to me to hide the user
    > control)?
    >
    > Regards
    > John.
    >
    >
     
    Stefan Landgraf, Aug 19, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew
    Replies:
    0
    Views:
    668
    Andrew
    Aug 12, 2003
  2. Miguel Angel Dinelli
    Replies:
    1
    Views:
    448
    Chris Jackson
    Nov 13, 2003
  3. Justin

    Error-- Specified cast is not valid

    Justin, Dec 3, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    431
    Kevin Spencer
    Dec 3, 2003
  4. sviau
    Replies:
    3
    Views:
    4,775
    Steven Cheng[MSFT]
    Feb 17, 2004
  5. Alan Silver
    Replies:
    5
    Views:
    2,591
    Kevin Spencer
    Feb 15, 2005
Loading...

Share This Page