Question Masterpage Custom Context Menu

benjamin

Member
Joined
Nov 5, 2008
Messages
22
Location
Cook Islands
Programming Experience
5-10
I have a custom area in a masterpage in which i generate custom content including things like drop downs for filter options, links for drill down etc.

I'm trying to detect the selection in a drop down list so that i can apply this to a dataset within the contentplaceholder during page.load.

I can't seem to detect the drop down from the page code, although i can locate the table in which i have placed everything (have programmatically added these by declaring each drop down and adding to a cell).

Wondering if anyone has any suggestions as to why i can't - or a better approach.

Once i have the table, table.controls.count is nothing?
 
How do you have added your controls ? By table.Controls.Add() or directly in the .aspx file ?
If you have inserted them dynamically, it's normal, you can not have access to from the code-behind. You can not test like this:

VB.NET:
If IsPostBack Then
  If MyDdl.SelectedItem.Value = "foo" Then
    ' bla bla bla
  End If
End If

But if you know exactly the id you gave to your ddl, you can take the values back from Request.Params(id_of_ddl)

After, is it normal that table.Controls.Count is equals to 0, it depends of the position of your test. If it is just at the begining of the Load method, yes it's normal. It should be greater than 0 after the table controls definitions.

Hope it helps
 
Back
Top