473,471 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

LinqDataSource - Parameters

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
Aug 3 '08 #1
5 2572
Philip wrote:
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
Aug 3 '08 #2
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
"Lloyd Sheen" wrote:
Philip wrote:
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
Aug 3 '08 #3
Philip wrote:
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
Aug 3 '08 #4
So you are saying there is no way to use Inline Code within a SELECT set of
Parameters ?

Thanks for your prompt reply.
--
Philip
"Lloyd Sheen" wrote:
Philip wrote:
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
Aug 3 '08 #5
Philip wrote:
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
Aug 3 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: shapper | last post by:
Hello, I have a LinqDataSource connected to a GridView. I created the following deleting event: Private Sub ldsTags_Deleting(ByVal sender As Object, ByVal e As...
0
by: =?Utf-8?B?UmFzbXVz?= | last post by:
I have a simple LiveView control that databinds to a LinqDataSource that maps to a table like this: CREATE TABLE MyTable (Id int NOT NULL, Name nvarchar(50) NULL, Picture image NULL) The OR...
1
by: shapper | last post by:
Hello, How can I get the ID (primary key) of a record just inserted in a database table by a LinqDataSource? Thanks, Miguel
1
by: shapper | last post by:
Hello, I have a ListView connected to a LinqDataSource. It uses a table, named Tags, with 2 fields: TagId and Text. I need to add a column named active. For this I created a LinqDataSource...
0
by: Marius Manolea | last post by:
Hi, I have a strange problem, I don't receive any modifications from listview in edit mode (OldValues & NewValues are empty) <asp:ListView ID="lvEditPersonRoles" runat="server"...
2
by: =?Utf-8?B?UGhpbGlw?= | last post by:
I am attempting to insert a simple record with LinqDataSource from a ListView, however I always get a message saying "....LinqDataSource 'dataSource' has no values to insert. Check that the...
3
by: david | last post by:
I've bound my GridView to a LinqDataSource control, but now I want to do some work in the RowDataBound event. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { var...
0
by: Andy B | last post by:
I have a GridView with a LINQDataSource attached to it. My code in the aspx markup is below. I need to know why only the checkbox field for the activated column is getting updated (the...
2
by: mesut | last post by:
Hi colleagues, how can I configure a linqdatasource in code behind. I mean I would like to create the linqdatasource programmatically in the code behind rather then dropping from the toolbox. ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.