Link to home
Start Free TrialLog in
Avatar of David Megnin
David MegninFlag for United States of America

asked on

Insert Server Variable into GridView upon editing.

In my GridView I'd like to put the equivilant of this:  Request.ServerVariables("AUTH_USER") into the column called "ModifiedBy".

The idea is when someone edits a row their logged in user name is put into the "ModifiedBy" column.
Avatar of Daniel Van Der Werken
Daniel Van Der Werken
Flag of United States of America image

I think you want to look into BIND and EVAL:

http://msdn.microsoft.com/en-us/library/ms178366.aspx

Avatar of David Megnin

ASKER

What I want is to grab the Server Variable for the logged in user as a parameter and plug it into the GridView.

The ModifiedBy field is currently a BoundField, but I could change it to a TemplateField.  I just don't know how to get the Server Variable for the logged in user value into the GridView.  I expect it will have to be done in the VB code behind, but I'm not sure if it can't be done in the GridView markup some how.

Text='<%# Bind([Server Variable for logged in user]) %>'  ??
This is your required server variable:
Text='<%# Bind([this.Page.User.Identity.Name]) %>'
SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
With square brackets, round brackets or no brackets?
Text='<%# Bind([Page.User.Identity.Name]) %>'
Text='<%# Bind([Request.LogonUserIdentity.Name]) %>'
Text='<%# Bind(Page.User.Identity.Name) %>'
Text='<%# Bind(Request.LogonUserIdentity.Name) %>'

All those give me a Parse Error:  A call to Bind was not well formatted.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I ended up going a different route, but mas_oz2003's help lead me down the right path.  I used a different method, but gave mas_oz2003 the points for the aid.
Thanks for the help.  It lead me in the right direction.