Passing web controls to an external method

  • Thread starter Thread starter Andy B.
  • Start date Start date
A

Andy B.

I have the following method stub:

public function DeleteNewsArticle(ByVal NewsID as Guid, ByVal Title as
string, ByVal Description as string, ByVal Body as string, ByVal Archived as
boolean, ByRef NewsList as object) as integer
end function

The NewsList as object is the entire list of news articles. Chances are is
that it will be a gridView. How do I check to see what type of control it is
and convert it back to its original control type?
 
Use the GetType and CType methods. However, I would suggest making your
signature a little more specific than Object. Even if you are not going to
make it ByRef NewsList as GridView, you could at least make it ByRef
NewsList as Control or ByRef NewsList as WebControl. Hopefully this helps.
 
Back
Top