Note that there are some explanatory texts on larger screens.

plurals
  1. POObjectDataSource -> SelectMethod is not specified
    primarykey
    data
    text
    <p>I created a <strong>UserControl</strong> with ObjectDataSource + ASPxGridView. <strong>SelectMethod</strong> of ObjectDataSource I set the dynamicly depending on public parameter of UserControl:</p> <pre><code>private int _companyID = -1; public int CompanyID { get { return _companyID; } set { _companyID = value; dsPersons.SelectMethod = "GetPersonsByCompany"; dsPersons.SortParameterName = "sort"; dsPersons.SelectParameters.Clear(); dsPersons.SelectParameters.Add("companyID", DbType.Int32, value.ToString()); } } </code></pre> <p>When I use my control on Page like this:</p> <pre><code>&lt;uc:PersonsManager ID="personsManager" runat="server" CompanyID="2" /&gt; </code></pre> <p>or put it in another ASPxGridView like this:</p> <pre><code>&lt;dxwgv:ASPxGridView ID="gridViewCompany" runat="server" DataSourceID="dsCompany" KeyFieldName="ID" Width="100%" AutoGenerateColumns="false"&gt; &lt;Columns&gt; &lt;dxwgv:GridViewDataColumn&gt; &lt;DataItemTemplate&gt; &lt;uc:PersonsManager ID="personsManager" runat="server" CompanyID='&lt;%# Bind("ID") %&gt;' /&gt; &lt;/DataItemTemplate&gt; &lt;/dxwgv:GridViewDataColumn&gt; &lt;/Columns&gt; &lt;/dxwgv:ASPxGridView&gt; </code></pre> <p><strong>All works fine, but I wanna to declare Control parameter from code-behind</strong>:</p> <pre><code>&lt;uc:PersonsManager ID="personsManager" runat="server" /&gt; </code></pre> <p>and then on Page_Load:</p> <pre><code>personsManager.CompanyID = 2; </code></pre> <p>And if I use previous declaration then I can see only first load of UserControl's ASPxGridView with some data, because any manipulation will cause error on HtmlRowCreated event of UserControl's ASPxGridView:</p> <blockquote> <p>The Select operation is not supported by ObjectDataSource 'dsPersons' unless the SelectMethod is specified.</p> </blockquote> <p>Why is this happening?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload