Solved

Edit gridview and set field value = to Session variable

Posted on 2009-05-20
1
564 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
1 Comment
 
LVL 16

Accepted Solution

by:
Steve Krile earned 500 total points
Comment Utility
use the SessionParameter:

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

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

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now