Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

feeding a seesion/parameter value to Gridview

 
 
staffan
Guest
Posts: n/a
 
      12-07-2006
Hi

I am quite new to asp.net 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?

Thanks!!!!

/Staffan



"
<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">

</asp:SqlDataSource>"






 
Reply With Quote
 
 
 
 
Phil H
Guest
Posts: n/a
 
      12-20-2006
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 -->

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


</asp:SqlDataSource>

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

 
Reply With Quote
 
 
 
Reply

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



Advertisments