dcsimg
Results 1 to 2 of 2

Thread: How to - Assign a value to a FormView Field?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    9

    Arrow How to - Assign a value to a FormView Field?

    Hello,

    Well thanks to all I now can reference a field in the formview, but, assigning it a value is fighting me.

    I want to assign the UserName field in the formview with the login name from the Master (HttpContext.Current.User.Identity.Name).

    (A) I tried the likes of: FormView1.FindControl("UserName").DefaultValue = username but of course that doesn't work.

    (B) Alternatively, I tried to edit the SQL so that I passed it the HttpContext.Current.User.Identity.Name but didn't have any luck.

    InsertCommand="INSERT INTO [TechUserName] ([CertName], [CertLevel], [CertLast], [CertFreq], [CertDue]) VALUES (@temp1, @CertLevel, @CertLast, @CertFreq, @CertDue)"

    temp1.text=(HttpContext.Current.User.Identity.Name)

  2. #2
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,966

    Re: How to - Assign a value to a FormView Field?

    Have you tried just using the LoginName control?

    http://msdn.microsoft.com/en-us/libr...loginname.aspx

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width