Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Accessing .ascx elements in .ASPX pages

  Asked By: Dora    Date: Jul 01    Category: Asp.net    Views: 1523

I have a custom control that is called twice in my HTML page.
I am trying to access the item.SelectedIndex.Value property for these
two controls.....but the .vb continually complains that the object(s)
are not present.
Is there some trick to get to the properties of custom controls that
I'm missing?



1 Answer Found

Answer #1    Answered By: Calandre Bernard     Answered On: Jul 01

Basically for isolation purposes you cannot talk directly to objects inside the .ascx

Look at:
and see the way that we grab the selected item  from the listbox

public choice as string

Sub Page_Load(S As Object, E As EventArgs)
If ispostback=false THEN
End Sub

Then in our code for example we can refer to cy.choice for example to get the selected item for cy
and zp.choice to get the selected item fro zp.

Didn't find what you were looking for? Find more on Accessing .ascx elements in .ASPX pages Or get search suggestion and latest updates.