ChiBella
asked on
LinqDataSource within User Control - how to pass parameters from aspx to control?
I want to set the where parameters of a linqdatasource with values from properties set when the user control is loaded (passed from the calling aspx page).
I tried using the parameter option within whereparameters but this didn't work. How can I set the datasource where parameters with values from properties set within code behind.
I tried using the parameter option within whereparameters but this didn't work. How can I set the datasource where parameters with values from properties set within code behind.
<asp:LinqDataSource ID="LinqDataNotes1" runat="server"
ContextTypeName="Example.SomeDataContext"
Select="new (someinfo)"
Where='NAME=@name AND ID= @ID' TableName="SomeTable">
<WhereParameters>
<asp:Parameter
Name="ID"
DefaultValue="0"
Type="Int32" />
<asp:Parameter
Name="name"
DefaultValue=""
Type="String"/>
</WhereParameters>
</asp:LinqDataSource>
ASKER
That is not what I am asking...but thanks....
What I want to know is how to pass a parameter from the web page to the control page user {get set} or some other method so that I can set the where clause of a LinqDataSource.
Maybe I'm missing something in your response. Can you explain how to set the where clause from passed parameters?
What I want to know is how to pass a parameter from the web page to the control page user {get set} or some other method so that I can set the where clause of a LinqDataSource.
Maybe I'm missing something in your response. Can you explain how to set the where clause from passed parameters?
Do you want to get a parameter to this page where you have the datasource from another page? If so you can use query string parameters.
ASKER
Since this is a user control and I can set properties on the user control from the page the user control is used on, isn't there a better way?
If I set public properties on the page can I get to them?
If I set public properties on the page can I get to them?
ASKER
I will use this control several times within a page -- each time I will set a different parameter value for the where clause...which will populate several grids with different queries on the page.
I must be missing something basic on how to set the parameters on a linqdatasource????
Can anyone steer me in the right direction?
I must be missing something basic on how to set the parameters on a linqdatasource????
Can anyone steer me in the right direction?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<asp:LinqDataSource ID="LinqDataNotes1".....
code behind
LinqDataNotes1.<Propertyx>