This is a migrated thread and some comments may be shown as answers.

Can't find the control ID of Combox inside MasterTableView

1 Answer 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kelly
Top achievements
Rank 1
Kelly asked on 29 May 2012, 05:56 AM
There is a problem when i am try to pass this 
<asp:ControlParameter Name="Com_Name" PropertyName="SelectedValue" ControlD="comNameFilter" /> 
It says 

Could not find control 'comNameFilter' in ControlParameter 'Com_Name'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.InvalidOperationException: Could not find control 'comNameFilter' in ControlParameter 'Com_Name'.

and i try the other IDs which is fine.
Can any body please tell me how can i fixed it 
by finding the control Id of Combobox or any other way to do it?
Thanks very much
 


    <telerik:RadGrid ID="RGBranch" runat="server"
      AllowPaging="True" AllowSorting="True" CellSpacing="0" GridLines="None" OnNeedDataSource="RadGridList_NeedDataSource"
      Skin="Windows7" AllowFilteringByColumn="True" AllowMultiRowSelection="True" EnabledViewState="true"
      AutoGenerateColumns="False" OnDeleteCommand="RGBranch_DeleteCommand">
      <MasterTableView DataKeyNames="Com_ID,Branch_No" ClientDataKeyNames="Com_ID,Branch_No" >
        <Columns>
        <telerik:GridClientSelectColumn UniqueName="Selected" FilterControlAltText="Filter Selected Column">
        </telerik:GridClientSelectColumn>
          <telerik:GridBoundColumn DataField="Com_ID" Visible="false" />
          <telerik:GridBoundColumn DataField="Com_Name" HeaderText="Company">
          <FilterTemplate>
          <telerik:RadComboBox ID="comNameFilter" EnableLoadOnDemand="true" ShowToggleImage="false"
          EnableAutomaticLoadOnDemand="True" ItemsPerRequest="10" EnableVirtualScrolling="true" DataSourceID="DataSource"
           MarkFirstMatch="true" runat="server" DataTextField="Com_Name" DataValueField="Com_Name">
          </telerik:RadComboBox>
          </FilterTemplate>
          </telerik:GridBoundColumn>
          <telerik:GridBoundColumn DataField="Branch_No" HeaderText="Branch No" />
          <telerik:GridBoundColumn DataField="Branch_Name" HeaderText="Branch Name" />
          <telerik:GridCheckBoxColumn DataField="Is_Reservation_Enabled" HeaderText="Reservation"
            ItemStyle-Width="5%" />
          <telerik:GridCheckBoxColumn DataField="Is_Takeaway_Enabled" HeaderText="Takeaway"
            ItemStyle-Width="5%" />
          <telerik:GridBoundColumn DataField="Last_Update_Date" HeaderText="Last Update On" />
          <telerik:GridTemplateColumn AllowFiltering="false">
            <ItemTemplate>
              <asp:LinkButton ID="lbtnDel" OnClientClick="return confirm('Are you sure?')" runat="server"
                CommandName="Delete">Delete</asp:LinkButton>
            </ItemTemplate>
          </telerik:GridTemplateColumn>
        </Columns>
        <PagerStyle Mode="NextPrevAndNumeric"/>
      </MasterTableView>
      <ClientSettings>
        <Selecting AllowRowSelect="true" />
        <ClientEvents OnRowDblClick="RowDblClick" />
      </ClientSettings>
    </telerik:RadGrid>
    <asp:SqlDataSource ID="DataSource" connectionString="server=sql2008;database=QuoteNOWDB2;uid=sa;pwd=holiday" runat="server"
    SelectCommand = "select distinct LoginUserCom.Com_Name FROM LoginUserCom INNER JOIN Branch 
                     ON LoginUserCom.Com_ID = Branch.Com_ID where LoginUserCom.Com_Name = @Com_Name order by LoginUserCom.Com_Name"> 
    <SelectParameters>
                <asp:ControlParameter Name="Com_Name" PropertyName="SelectedValue" ControlID="comNameFilter" />
            </SelectParameters>    
    </asp:SqlDataSource>

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 29 May 2012, 10:34 PM
Kelly:

Take a look at this forum post: Problems with controlparameters using GridDropDownColumns in RadGrid. It appears that using declarative data sources in this case will not work, as you will not be able to access the selected value of the comNameFilter.

Rather, you can use the approach used in the demo below to achieve your requirement. Note that the difference in the implementation is the accessing of controls.

ComboBox/Related ComboBoxes

Hope this helps!
Tags
Grid
Asked by
Kelly
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or