LinqDataSource - Parameters

  • Thread starter Thread starter Philip
  • Start date Start date
P

Philip

I am using the LINQDataSource.

I want to use a Parameter to for Select which is essentially a value within
a code variable. I have tried using inline code for the asp:Parameter
DefaultValue, however this is not being driven.

Here is my existing code...

<asp:LinqDataSource ID="dataSource" runat="server"
ContextTypeName="SLCMS_DB_DataContext"
TableName="SLCMS_BannerAds"
Select="new(BannerAdKey, Enabled, ImageUrl, NavigateUrl,
AlternateText, Impressions, Width, Height, PublishDateTime)"
Where="Application=@Application && Group=@Group">
<WhereParameters>
<asp:SessionParameter Name="Application"
Type="String"
SessionField="_ConfigApplicationName" />
<asp:ControlParameter
Name="Group"
ControlID="RadTreeView1"
PropertyName="SelectedValue"
Type="String" />
</WhereParameters>
</asp:LinqDataSource>


Rather than have the SessionParameter I would like to use a asp:Parameter
with a DefaultValue='<%= GetMyParameter() %>'.....however this will not
work....


Do you have any suggestions ? I essentially want to bring the Parameter in
from a code variable.
 
Philip said:
I am using the LINQDataSource.

I want to use a Parameter to for Select which is essentially a value within
a code variable. I have tried using inline code for the asp:Parameter
DefaultValue, however this is not being driven.

Here is my existing code...

<asp:LinqDataSource ID="dataSource" runat="server"
ContextTypeName="SLCMS_DB_DataContext"
TableName="SLCMS_BannerAds"
Select="new(BannerAdKey, Enabled, ImageUrl, NavigateUrl,
AlternateText, Impressions, Width, Height, PublishDateTime)"
Where="Application=@Application && Group=@Group">
<WhereParameters>
<asp:SessionParameter Name="Application"
Type="String"
SessionField="_ConfigApplicationName" />
<asp:ControlParameter
Name="Group"
ControlID="RadTreeView1"
PropertyName="SelectedValue"
Type="String" />
</WhereParameters>
</asp:LinqDataSource>


Rather than have the SessionParameter I would like to use a asp:Parameter
with a DefaultValue='<%= GetMyParameter() %>'.....however this will not
work....


Do you have any suggestions ? I essentially want to bring the Parameter in
from a code variable.

In code can you not capture the Selecting event and then ensure that the
parameter has the correct value?

LS
 
Sure....I could do that....but I was wanting to determine if there is a
simply way to access code variables from the asp:Parameter ???

Any further thoughts ?
 
Philip said:
Sure....I could do that....but I was wanting to determine if there is a
simply way to access code variables from the asp:Parameter ???

Any further thoughts ?
Sorry thats the best I got.
LS
 
So you are saying there is no way to use Inline Code within a SELECT set of
Parameters ?

Thanks for your prompt reply.
 
Philip said:
So you are saying there is no way to use Inline Code within a SELECT set of
Parameters ?

Thanks for your prompt reply.
Nope, what I was showing was the way I do it. I am sure there must be a
way but I have not used it. Sorry

LS
 
Back
Top