Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > feeding a seesion/parameter value to Gridview

Thread Tools

feeding a seesion/parameter value to Gridview

Posts: n/a

I am quite new to and before in old asp I used Session variables
with <% %> to have dynamic parametrars in a SQL Stmt for example. But the
serverside tag donīt accept <% %>. So what should a use? Is there serverside
sessions and how do I use them or is there a simple method to use?



<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:s11243291ConnectionString %>"

SelectCommand="SELECT TOP 100 PERCENT dbo.t_Choice.timeofchoice,
t_Action.Actionname, dbo.t_Logg_call.infobox, dbo.t_Choice.choice,
dbo.t_Logg_call.aNumber FROM dbo.t_Choice INNER JOIN dbo.t_Logg_call ON
dbo.t_Choice.FK_CallID = dbo.t_Logg_call.CallID LEFT OUTER JOIN t_Action ON
dbo.t_Choice.choice = t_Action.choiceCondition WHERE
(dbo.t_Logg_call.FK_Customer = 1) AND (t_Action.FK_Customer = 1) AND
(t_Action.NoAction = 0) ORDER BY dbo.t_Choice.timeofchoice DESC">


Reply With Quote
Phil H
Posts: n/a
Hi Steffan

An SqlDataSource component can be configured with parameters that draw
their values from Session Variables using the "Configure Datasource"
wizard in VS 2005 or Visual web developer Express edition (the latter
being totally free of charge from Microsoft).

Alternatively, if you want to work directly in source code, then you
need to add Parameter tags like the following example:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MCCConnectionString %>"
SelectCommand="SELECT STAFF_ID, Title, Forename, Surname,
email, School_initials FROM Staff WHERE (LeavingDate IS NULL) AND
(Surname = @surname) ORDER BY Surname, Forename">

<!-- add parameters using the syntax of this example -->

<asp:SessionParameter Name="surname"
SessionField="sname" />


The 'SessionField' attribute names the session variable to use.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
feeding a value to a js file from a perl one Nikos Perl Misc 4 05-02-2005 08:52 PM
! It's Time To STOP Feeding USA Judges & Lawyers Canobull Righteous Computer Support 8 04-16-2005 04:55 AM
feeding data to an xml form judy XML 0 11-20-2004 02:41 AM
Feeding Frenzy jane jones Computer Support 2 05-23-2004 05:39 PM
Re: Feeding long input to showDocument: any way to use POST? Andrew Thompson Java 1 04-02-2004 02:22 PM