Skip to content Skip to sidebar Skip to footer

Is It Possible To Use A Control In A Different Content Tag As A Parameter?

I currently have two Web Controls, one being a CheckBoxList, and the other a GridView. The GridView's data configuration has a parameter in it's query which is linked to the select

Solution 1:

Seems a little krufty but you could put a HiddenControl in the ResultPanel and then set it's value to that of cbList1.SelectedValue on page load.

I know you can access controls regardless of the Content they are in, from code behind but apparently you can't from within the Content itself on the aspx side.

Solution 2:

Apparently this can be done by prefixing the ContentPlaceHolderID to the ControlID of the parameter entry. In my case, the code would be:

SelectParameters>
        <asp:ControlParameterControlID="LeftContent:cbList1"Name="?"PropertyName="SelectedValue" /></SelectParameters>

since the Control the parameter reads from is in the LeftContent tag.

Solution 3:

Some years later... I had the same problem with a gridview and a control parameter. In the source-code of the rendered page, you can find the exact "path" to the element. In my case it was not only gv1$txtEmployeeName, but gv1$ctl02$txtEmplyeeName.

I guess, ctl02 means EditItemTemplate, because including ctl02$ solved my problem.

Post a Comment for "Is It Possible To Use A Control In A Different Content Tag As A Parameter?"