-
Apr 13th, 2012, 08:11 AM
#1
Thread Starter
Addicted Member
How to see a control in another contentplaceholder?
I'm using a masterpage and having some trouble with my ContentPlaceholders.
I have a combobox(DropDownList1) in the sidemenu content placeholder and in my main placeholder I have a gridview. The gridview is supposed to do a select in the db using the selected value of DropDownList1. When I set up the connection SQL within the datagrid, using the wizard; I select to get a parameter from a control and then I select DropDownList1.
NOW:
When I try to run the page, it returns an error "Exception Details: System.InvalidOperationException: A control with ID 'DropDownList1' could not be found", however if I move DropDownList1 to the main placeholder, everything works perfectly.
How do I get asp.net to see the control sitting in the other placeholder?
-
Apr 13th, 2012, 02:26 PM
#2
Hyperactive Member
Re: How to see a control in another contentplaceholder?
use findControl. something like this:
dim myControl = Me.SomeControl.FindControl("dateTimePicker1").FindControl("getDateTb")
you can use findControl for each depth
if i was able to help, rate my post!
-
Apr 16th, 2012, 01:55 AM
#3
Thread Starter
Addicted Member
Re: How to see a control in another contentplaceholder?
Originally Posted by jasonwucinski
use findControl. something like this:
dim myControl = Me.SomeControl.FindControl("dateTimePicker1").FindControl("getDateTb")
you can use findControl for each depth
I tried that, but could not get it to work properly. I finally got it to work by prefixing the contentplaceholder's ID to the id of the control reference
HTML Code:
<asp:ControlParameter ControlID="LeftMenu$DropDownList1" Name="UserId"
PropertyName="SelectedValue" Type="Int32" />
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|