feeding a seesion/parameter value to Gridview

Discussion in 'ASP .Net Datagrid Control' started by staffan, Dec 7, 2006.

  1. staffan

    staffan Guest

    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>"
    staffan, Dec 7, 2006
    #1
    1. Advertising

  2. staffan

    Phil H Guest

    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.
    Phil H, Dec 20, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ashish

    seesion cookie question.

    ashish, Mar 10, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    399
    ashish
    Mar 10, 2005
  2. Leon

    seesion state question?

    Leon, Jun 13, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    367
    Brock Allen
    Jun 13, 2005
  3. =?Utf-8?B?dGhlamFtaWU=?=

    Seesion Manager

    =?Utf-8?B?dGhlamFtaWU=?=, Mar 7, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    374
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Mar 7, 2007
  4. Replies:
    3
    Views:
    423
    Cowboy \(Gregory A. Beamer\)
    Apr 26, 2007
  5. =?Utf-8?B?QWxleA==?=

    Flash menu doesn't work if the seesion is expired

    =?Utf-8?B?QWxleA==?=, Jun 26, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    418
    Samuel R. Neff
    Jun 27, 2007
Loading...

Share This Page