Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Edit gridview and set field value = to Session variable

Posted on 2009-05-20
1
Medium Priority
?
572 Views
Last Modified: 2013-11-25
How can I set the value of a USER_NAME field to the value of a session variable?  
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
                SelectCommand="SELECT PERSONNEL_ID, CATEGORY, NAME, RECORD_STATUS  FROM table WHERE (RECORD_STATUS = 'Active')"               
                UpdateCommand="UPDATE table SET CATEGORY = :CATEGORY, NAME = :NAME, RECORD_STATUS = :RECORD_STATUS, USER_ID= :USER_ID (PERSONNEL_ID = :PERSONNEL_ID)">
                <UpdateParameters>
                    <asp:Parameter Name="CATEGORY" />
                    <asp:Parameter Name="NAME" />
                    <asp:Parameter Name="RECORD_STATUS" />
                    <asp:Parameter Name="PERSONNEL_ID" />
                    <asp:Parameter Name="USER_ID"  DefaultValue=Session(userName) />
                </UpdateParameters>
            </asp:SqlDataSource>

Open in new window

0
Comment
Question by:DotNetNooby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
Steve Krile earned 2000 total points
ID: 24435441
use the SessionParameter:

<asp:SessionParameter Name="varnname" SessionField="SessionFieldName" />

instead of <asp:Parameter....>
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question