Using a web control from a different page

  • Thread starter Thread starter Dina
  • Start date Start date
D

Dina

If anyone could assist me with this issue, I'd really appreciate it!

I have a literal web control, litControl1, in webForm.aspx.
I want to modify the litControl text property from a user control
code-behind page, userControl.ascx.vb.

To do this with VS2003, I had to modify the Web Form Designer Generated
code
from
Protected WithEvents litControl1 As System.Web.UI.WebControls.Literal
to
Public Shared litControl1 As System.Web.UI.WebControls.Literal

and then I could access the property using webForm.litControl1.text =
"whatever"

Since upgrading to VS2005, this code is no longer valid.

Does anyone have any thoughts on any other methods to try???

Thanx in advance!!!
-Dina
 
this technique no longer works with 2005.

what you have to do is create a base class or interface in the app_code dir
that defines a public method to access the literal control. then have the
page inherit and implement this method. the user control can then cast the
page to the base or interface and access the method.

-- bruce (sqlwork.com)
 

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

Back
Top