locked
trouble with function to get data for FormView RRS feed

  • Question

  • User759549661 posted

    Hi, I’m building a website with ASP.NET in Visual Studio Express 2013 for Web, based on the tutorial with the WingTip Toys example, as implemented in Visual Basic by James Chaney (https://code.msdn.microsoft.com/ASPNET-45-Web-Forms-f37f0f63).

    It has mostly gone well, by adapting the example to my purposes.

    <o:p></o:p>

    <o:p></o:p>

    <o:p></o:p>

    However: I’m trying to design a page to allow users to edit information about themselves, using a FormView control, and am having trouble showing a selected user data record for editing. I first made a simple table UserInfoes:<o:p></o:p>

    CREATE TABLE [dbo].[UserInfoes] (<o:p></o:p>

        [UserInfoId]  INT            IDENTITY (1, 1) NOT NULL,<o:p></o:p>

        [Username]    NVARCHAR (MAX) NULL,<o:p></o:p>

        [FirstName]   NVARCHAR (MAX) NULL,<o:p></o:p>

        [LastName]    NVARCHAR (MAX) NULL,<o:p></o:p>

        [Department]  NVARCHAR (MAX) NULL,<o:p></o:p>

        [Institution] NVARCHAR (MAX) NULL,<o:p></o:p>

        [Address]     NVARCHAR (MAX) NULL,<o:p></o:p>

        [City]        NVARCHAR (MAX) NULL,<o:p></o:p>

        [State]       NVARCHAR (MAX) NULL,<o:p></o:p>

        [PostalCode]  NVARCHAR (MAX) NULL,<o:p></o:p>

        [Country]     NVARCHAR (MAX) NULL,<o:p></o:p>

        [Phone]       NVARCHAR (MAX) NULL,<o:p></o:p>

        [Email]       NVARCHAR (MAX) NULL,<o:p></o:p>

        CONSTRAINT [PK_dbo.UserInfoes] PRIMARY KEY CLUSTERED ([UserInfoId] ASC)<o:p></o:p>

    );<o:p></o:p>

    The idea is to use the Username from the AspNetUsers table to select the user record from the UserInfoes table. Based on the ContosoUniversity example of Tom FitzMacken (https://docs.microsoft.com/en-us/aspnet/web-forms/overview/presenting-and-managing-data/model-binding/updating-deleting-and-creating-datait should be possible to do this using a FormView control and the UpdateMethod. I would like if possible to use the same entry format as the Login page. So I made a page with similar controls, and put it inside a FormView control with an EditItemTemplate:

    <o:p></o:p>

    <%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="AddUserInfo.aspx.vb" Inherits="LabEle3.AddUserInfo" %><o:p></o:p>

    <%@ Import Namespace="LabEle3" %><o:p></o:p>

    <%@ Import Namespace="Microsoft.AspNet.Identity" %><o:p></o:p>

    <asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent"><o:p></o:p>

        <h2><%: Title %>.</h2><o:p></o:p>

        <p class="text-danger"><o:p></o:p>

            <asp:Literal runat="server" ID="ErrorMessage" /><o:p></o:p>

        </p><o:p></o:p>

    <o:p> </o:p>

        <asp:FormView ID="UserDetails" runat="server" <o:p></o:p>

            ItemType="LabEle3.UserInfo" <o:p></o:p>

            SelectMethod ="UserDetails_GetData" <o:p></o:p>

            UpdateMethod="UserDetails_UpdateItem"<o:p></o:p>

            DataKeyNames="Username" <o:p></o:p>

            RenderOuterTable="false"><o:p></o:p>

            <EditItemTemplate><o:p></o:p>

                <div class="form-horizontal"><o:p></o:p>

                    <h4>Edit User Profile</h4><o:p></o:p>

                    <hr /><o:p></o:p>

                    <asp:ValidationSummary runat="server" CssClass="text-danger" /><o:p></o:p>

                    <div class="form-group"><o:p></o:p>

                        <asp:Label runat="server" AssociatedControlID="UserInfoId" CssClass="col-md-2 control-label">User ID</asp:Label><o:p></o:p>

                        <div class="col-md-10"><o:p></o:p>

                            <asp:TextBox runat="server" ID="UserInfoId" CssClass="form-control" TextMode="SingleLine" visible="true"/><o:p></o:p>

                            <asp:RequiredFieldValidator runat="server" ControlToValidate="UserInfoId"<o:p></o:p>

                                CssClass="text-danger" ErrorMessage="The UserInfoId field is required." /><o:p></o:p>

                        </div><o:p></o:p>

                    </div><o:p></o:p>

                    <div class="form-group"><o:p></o:p>

                        <asp:Label runat="server" AssociatedControlID="Username" CssClass="col-md-2 control-label">Username</asp:Label><o:p></o:p>

                        <div class="col-md-10"><o:p></o:p>

                            <asp:TextBox runat="server" ID="Username" CssClass="form-control" TextMode="SingleLine" visible="true"/><o:p></o:p>

                            <asp:RequiredFieldValidator runat="server" ControlToValidate="Username"<o:p></o:p>

                                CssClass="text-danger" ErrorMessage="The Username field is required." /><o:p></o:p>

                        </div><o:p></o:p>

                    </div><o:p></o:p>

                    <div class="form-group"><o:p></o:p>

                        <asp:Label runat="server" AssociatedControlID="FirstName" CssClass="col-md-2 control-label">First Name</asp:Label><o:p></o:p>

                        <div class="col-md-10"><o:p></o:p>

                            <asp:TextBox runat="server" ID="FirstName" CssClass="form-control" TextMode="SingleLine" /><o:p></o:p>

                            <asp:RequiredFieldValidator runat="server" ControlToValidate="FirstName"<o:p></o:p>

                                CssClass="text-danger" ErrorMessage="The First Name field is required." /><o:p></o:p>

                        </div><o:p></o:p>

                    </div><o:p></o:p>

                    <div class="form-group"><o:p></o:p>

                        <asp:Label runat="server" AssociatedControlID="LastName" CssClass="col-md-2 control-label">Last Name</asp:Label><o:p></o:p>

                        <div class="col-md-10"><o:p></o:p>

                            <asp:TextBox runat="server" ID="LastName" TextMode="SingleLine" CssClass="form-control" /><o:p></o:p>

                            <asp:RequiredFieldValidator runat="server" ControlToValidate="LastName"<o:p></o:p>

                                CssClass="text-danger" ErrorMessage="The Last Name field is required." /><o:p></o:p>

                        </div><o:p></o:p>

                    </div><o:p></o:p>

                    <div class="form-group"><o:p></o:p>

                        <asp:Label runat="server" AssociatedControlID="Department" CssClass="col-md-2 control-label">Department or Program</asp:Label><o:p></o:p>

                        <div class="col-md-10"><o:p></o:p>

                            <asp:TextBox runat="server" ID="Department" TextMode="SingleLine" CssClass="form-control" /><o:p></o:p>

                            <asp:RequiredFieldValidator runat="server" ControlToValidate="Department"<o:p></o:p>

                                CssClass="text-danger" ErrorMessage="The Department field is required." /><o:p></o:p>

                        </div><o:p></o:p>

                    </div><o:p></o:p>

                    <div class="form-group"><o:p></o:p>

                        <asp:Label runat="server" AssociatedControlID="Institution" CssClass="col-md-2 control-label">Institution</asp:Label><o:p></o:p>

                        <div class="col-md-10"><o:p></o:p>

                            <asp:TextBox runat="server" ID="Institution" TextMode="SingleLine" CssClass="form-control" /><o:p></o:p>

                            <asp:RequiredFieldValidator runat="server" ControlToValidate="Institution"<o:p></o:p>

                                CssClass="text-danger" ErrorMessage="The Institution field is required." /><o:p></o:p>

                        </div><o:p></o:p>

                    </div><o:p></o:p>

                    <div class="form-group"><o:p></o:p>

                        <asp:Label runat="server" AssociatedControlID="Email" CssClass="col-md-2 control-label">Email</asp:Label><o:p></o:p>

                        <div class="col-md-10"><o:p></o:p>

                            <asp:TextBox runat="server" ID="Email" CssClass="form-control" TextMode="Email" /><o:p></o:p>

                            <asp:RequiredFieldValidator runat="server" ControlToValidate="Email"<o:p></o:p>

                                CssClass="text-danger" ErrorMessage="The email field is required." /><o:p></o:p>

                        </div><o:p></o:p>

                    </div><o:p></o:p>

                    <div class="form-group"><o:p></o:p>

                        <div class="col-md-offset-2 col-md-10"><o:p></o:p>

                            <asp:Button runat="server" OnClick="CreateUserInfo_Click" Text="Done" CssClass="btn btn-default" /><o:p></o:p>

                        </div><o:p></o:p>

                    </div><o:p></o:p>

                </div><o:p></o:p>

            </EditItemTemplate><o:p></o:p>

        </asp:FormView><o:p></o:p>

    </asp:Content><o:p></o:p>

    <o:p> </o:p>

    The SelectMethod to get the data is:<o:p></o:p>

        Public Function UserDetails_GetData() As IQueryable(Of UserInfo)<o:p></o:p>

            Dim ThisUser As String = User.Identity.Name<o:p></o:p>

            Dim db = New UserContext()<o:p></o:p>

            'Dim query = db.UserInfoes.Where(Function(s) s.Username = ThisUser)<o:p></o:p>

            Dim query As IQueryable(Of UserInfo) = db.UserInfoes<o:p></o:p>

    <o:p> </o:p>

            If Not String.IsNullOrEmpty(ThisUser) Then<o:p></o:p>

                query = query.Where(Function(p) String.Compare(p.Username, ThisUser) = 0)<o:p></o:p>

            Else<o:p></o:p>

                query = Nothing<o:p></o:p>

            End If<o:p></o:p>

    <o:p> </o:p>

            Return Query<o:p></o:p>

        End Function<o:p></o:p>

    Where the classes UserContext and UserInfo are:<o:p></o:p>

    Imports System.Data.Entity<o:p></o:p>

    <o:p> </o:p>

    Public Class UserContext<o:p></o:p>

        Inherits DbContext<o:p></o:p>

        Public Sub New()<o:p></o:p>

            MyBase.New("LabEle3")<o:p></o:p>

        End Sub<o:p></o:p>

        Public Property UserInfoes() As DbSet(Of UserInfo)<o:p></o:p>

    End Class<o:p></o:p>

    <o:p> </o:p>

    And:<o:p></o:p>

    Imports System.Data.Entity<o:p></o:p>

    <o:p> </o:p>

    Public Class UserInfo<o:p></o:p>

    <o:p> </o:p>

        Public Property UserInfoId() As Integer<o:p></o:p>

        Public Property Username() As String<o:p></o:p>

        Public Property FirstName() As String<o:p></o:p>

        Public Property LastName() As String<o:p></o:p>

        Public Property Department() As String<o:p></o:p>

        Public Property Institution() As String<o:p></o:p>

        Public Property Address() As String<o:p></o:p>

        Public Property City() As String<o:p></o:p>

        Public Property State() As String<o:p></o:p>

        Public Property PostalCode() As String<o:p></o:p>

        Public Property Country() As String<o:p></o:p>

        Public Property Phone() As String<o:p></o:p>

        Public Property Email() As String<o:p></o:p>

    <o:p> </o:p>

    End Class<o:p></o:p>

    However, the value of query never seems to get set. In debug mode in the Immediate window it shows as:<o:p></o:p>

    ?query (before .where)<o:p></o:p>

    "System.Data.Entity.DbSet`1[LabEle3.UserInfo]"<o:p></o:p>

        System.Data.Entity.DbSet(Of LabEle3.UserInfo): "System.Data.Entity.DbSet`1[LabEle3.UserInfo]"<o:p></o:p>

    ?query (after .where)<o:p></o:p>

    "System.Data.Entity.Infrastructure.DbQuery`1[LabEle3.UserInfo]"<o:p></o:p>

        System.Data.Entity.Infrastructure.DbQuery(Of LabEle3.UserInfo): "System.Data.Entity.Infrastructure.DbQuery`1[LabEle3.UserInfo]"<o:p></o:p>

    Consequently no records are returned, even though I know that UserInfoes contains a record with a Username value identical to the ThisUser value recovered by User.Identity.Name. <o:p></o:p>

    The page comes up blank (just the footer), but no error. <o:p></o:p>

    Is it correct to say DataKeyNames="Username", when the primary key of UserInfoes is UserInfoId? Username is the field to be selected on.<o:p></o:p>

    Clearly I’m missing the correct incantation to recover this record to base the control on. Any help would be greatly appreciated!<o:p></o:p>

    Thursday, December 28, 2017 9:05 PM

Answers

  • User-707554951 posted

    Hi MPT79,

    Following code works well, you could refer to it:

     <asp:FormView ID="FormView1" runat="server" DefaultMode="Edit"
                    SelectMethod="GetProducts" UpdateMethod="UpdateProduct" ItemType="SolutionOne.Models.ApplicationUser">
                    <EditItemTemplate>
                        <table>
                            <tr>
                                <td>ID</td>
                                <td>
                                    <%#:Item.Id%>
                                    <asp:HiddenField runat="server" ID="Id" Value='<%#BindItem.Id%>' />
                                </td>
                            </tr>
                            <tr>
                                <td>Name</td>
                                <td>
                                    <asp:TextBox runat="server" ID="Name" Text='<%# BindItem.Email %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>Price</td>
                                <td>
                                    <asp:TextBox runat="server" ID="Price" Text='<%# BindItem.PhoneNumber %>' />
                                </td>
                            </tr>
                        </table>
                        <asp:Button ID="Button1" runat="server"
                            CommandName="Update" Text="Save" />
                    </EditItemTemplate>
                </asp:FormView>

    CodeBehind:

    Dim context As ApplicationDbContext = New ApplicationDbContext
    
        
        Public Function GetProductList() As IList(Of ApplicationUser)
            Dim list As List(Of ApplicationUser) = New List(Of ApplicationUser)
            Dim usename As String = User.Identity.Name
            Dim user = from
            c
            Dim where As context.Users
            (c.UserName = usename)
            Dim c As select
            For Each u In user
                list.Add(u)
            Next
            Return list
        End Function
        
        Public Function GetProducts() As IQueryable(Of ApplicationUser)
            Return GetProductList.AsQueryable
        End Function
        
        Public Sub UpdateProduct(ByVal UserName As ApplicationUser)
            Dim db As ApplicationDbContext = New ApplicationDbContext
            Dim item As ApplicationUser = Nothing
            item = db.Users.Find(UserName.Id)
            If (item Is Nothing) Then
                ModelState.AddModelError("", String.Format("Item with id {0} was not found", UserName))
                Return
            End If
            
            UpdateModel(item)
            If ModelState.IsValid Then
                db.SaveChanges
            End If
            
        End Sub
    

    Note:BindItem property is used instead of Item when binding data to control’s properties. 

    Output:

    Best regards 

    Cathy

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 2, 2018 8:02 AM

All replies

  • User-707554951 posted

    Hi MPT79,

    1. set break point on UserDetails_GetData Methos to make sure it didn't return null value.
    2. Refer to the following code to update your code:
     public class UserInfo
        {       
                public string  Id { get; set; }
                public string Email { get; set; }
                public string PhoneNumeber { get; set; }      
        }
          <asp:FormView ID="FormView1" runat="server" DefaultMode="Edit" 
          SelectMethod="GetProducts" UpdateMethod="UpdateProduct" ItemType="SolutionOne.Models.UserInfo"> 
        <EditItemTemplate> 
        <table> 
        <tr> 
        <td>ID</td> 
        <td> 
    <%#:Item.Id%>
        <asp:HiddenField runat="server" ID="Id" Value='<%#Item.Id%>' /> 
        </td> 
        </tr> 
        <tr> 
        <td>Name</td> 
        <td> 
        <asp:TextBox runat="server" ID="Name" Text='<%# Item.Email %>' /> 
        </td> 
        </tr> 
        <tr> 
        <td>Price</td> 
        <td> 
        <asp:TextBox runat="server" ID="Price" Text='<%# BindItem.PhoneNumeber %>' /> 
        </td> 
        </tr> 
        </table> 
        <asp:Button ID="Button1" runat="server"  
            CommandName="Update" Text="Save" /> 
        </EditItemTemplate> 
    </asp:FormView>
      ApplicationDbContext context = new ApplicationDbContext();
            public IList<UserInfo> GetProductList()
            {
                List<UserInfo> list = new List<UserInfo>();
                string usename = User.Identity.Name;
    
                var user = from c in context.Users where c.UserName == usename select c;
                foreach (var u in user)
                {
                    list.Add(new UserInfo { Id = u.Id, Email = u.Email, PhoneNumeber = u.PhoneNumber });
                }
                return list;
    
            }
        public IQueryable<UserInfo> GetProducts()
        {
            return GetProductList().AsQueryable();
        }

    Output:

    Best regards 

    Cathy

    Friday, December 29, 2017 9:18 AM
  • User759549661 posted
    Cathy, thanks so much for your code. I have implemented it in VB instead of C#, and I now see the data showing.
    However, the Save button does not update the edited data, and I’m wondering what code you use for your UpdateProduct function.
    Here is the VB code I have used to get the data, based on your code:<o:p></o:p>
    Dim Newcontext As ApplicationDbContext = New ApplicationDbContext()<o:p></o:p>

        Public Function GetUser2() As IList(Of ShortUserInfo)<o:p></o:p>

            Dim list As New List(Of ShortUserInfo)()<o:p></o:p>

            Dim ThisUser As String = User.Identity.Name<o:p></o:p>

            Dim ThisUserInfo As New ShortUserInfo()<o:p></o:p>

            Try<o:p></o:p>

                Dim UserRecord = (From c In Newcontext.Users Where c.UserName = ThisUser Select c).FirstOrDefault<o:p></o:p>

                If UserRecord IsNot Nothing Then<o:p></o:p>

                    ThisUserInfo.Id = CType(UserRecord.Id, String)<o:p></o:p>

                    ThisUserInfo.UserName = CType(UserRecord.UserName, String)<o:p></o:p>

                    ThisUserInfo.Email = CType(UserRecord.Email, String)<o:p></o:p>

                    ThisUserInfo.PhoneNumeber = CType(UserRecord.PhoneNumber, String)<o:p></o:p>

                End If<o:p></o:p>

                list.Add(ThisUserInfo)<o:p></o:p>

            Catch exp As Exception<o:p></o:p>

                Throw New Exception("ERROR: Unable to find User - " & exp.Message.ToString(), exp)<o:p></o:p>

            End Try<o:p></o:p>

            Return list<o:p></o:p>

        End Function<o:p></o:p>

        Public Function GetThisUser2() As IQueryable(Of ShortUserInfo)<o:p></o:p>

            Return GetUser2.AsQueryable<o:p></o:p>

        End Function<o:p></o:p>

    Here is my function to attempt to update it the table via the Save button:<o:p></o:p>

        Public Sub UserDetails_UpdateItem()<o:p></o:p>

            Using db = New UserContext()<o:p></o:p>

                Dim item As UserInfo = Nothing<o:p></o:p>

                Dim ThisUser As String = User.Identity.Name<o:p></o:p>

                Dim UserRecord = (From c In db.UserInfoes Where c.Username = ThisUser Select c).FirstOrDefault<o:p></o:p>

                If UserRecord Is Nothing Then<o:p></o:p>

                    ModelState.AddModelError("", String.Format("Item with this Username was not found", ThisUser))<o:p></o:p>

                    Return<o:p></o:p>

                End If<o:p></o:p>

                TryUpdateModel(UserRecord)<o:p></o:p>

                If ModelState.IsValid Then<o:p></o:p>

                    db.SaveChanges()<o:p></o:p>

                End If<o:p></o:p>

            End Using<o:p></o:p>

        End Sub<o:p></o:p>

    There is no error when the Save button is clicked; the data in the table just does not update. But I’m half-way there!<o:p></o:p>

    Sunday, December 31, 2017 2:37 AM
  • User-707554951 posted

    Hi MPT79,

    Following code works well, you could refer to it:

     <asp:FormView ID="FormView1" runat="server" DefaultMode="Edit"
                    SelectMethod="GetProducts" UpdateMethod="UpdateProduct" ItemType="SolutionOne.Models.ApplicationUser">
                    <EditItemTemplate>
                        <table>
                            <tr>
                                <td>ID</td>
                                <td>
                                    <%#:Item.Id%>
                                    <asp:HiddenField runat="server" ID="Id" Value='<%#BindItem.Id%>' />
                                </td>
                            </tr>
                            <tr>
                                <td>Name</td>
                                <td>
                                    <asp:TextBox runat="server" ID="Name" Text='<%# BindItem.Email %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>Price</td>
                                <td>
                                    <asp:TextBox runat="server" ID="Price" Text='<%# BindItem.PhoneNumber %>' />
                                </td>
                            </tr>
                        </table>
                        <asp:Button ID="Button1" runat="server"
                            CommandName="Update" Text="Save" />
                    </EditItemTemplate>
                </asp:FormView>

    CodeBehind:

    Dim context As ApplicationDbContext = New ApplicationDbContext
    
        
        Public Function GetProductList() As IList(Of ApplicationUser)
            Dim list As List(Of ApplicationUser) = New List(Of ApplicationUser)
            Dim usename As String = User.Identity.Name
            Dim user = from
            c
            Dim where As context.Users
            (c.UserName = usename)
            Dim c As select
            For Each u In user
                list.Add(u)
            Next
            Return list
        End Function
        
        Public Function GetProducts() As IQueryable(Of ApplicationUser)
            Return GetProductList.AsQueryable
        End Function
        
        Public Sub UpdateProduct(ByVal UserName As ApplicationUser)
            Dim db As ApplicationDbContext = New ApplicationDbContext
            Dim item As ApplicationUser = Nothing
            item = db.Users.Find(UserName.Id)
            If (item Is Nothing) Then
                ModelState.AddModelError("", String.Format("Item with id {0} was not found", UserName))
                Return
            End If
            
            UpdateModel(item)
            If ModelState.IsValid Then
                db.SaveChanges
            End If
            
        End Sub
    

    Note:BindItem property is used instead of Item when binding data to control’s properties. 

    Output:

    Best regards 

    Cathy

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 2, 2018 8:02 AM
  • User759549661 posted

    Thanks again for all your code, Cathy. I’ve successfully implemented your update function in VB, like this:<o:p></o:p>

        Public Sub MyUserUpdate(ByVal UserInfoId As Int32)<o:p></o:p>

            Using db = New UserContext<o:p></o:p>

                Dim item As UserInfo = Nothing<o:p></o:p>

                item = db.UserInfoes.Find(UserInfoId)<o:p></o:p>

                If item Is Nothing Then<o:p></o:p>

                    ModelState.AddModelError("", String.Format("Item with id {0} was not found", UserInfoId))<o:p></o:p>

                    Return<o:p></o:p>

                End If<o:p></o:p>

                TryUpdateModel(item)<o:p></o:p>

                If ModelState.IsValid Then<o:p></o:p>

                    db.SaveChanges()<o:p></o:p>

                End If<o:p></o:p>

            End Using<o:p></o:p>

        End Sub<o:p></o:p>

    I was also able to update the table with this function, by adding OnClick="Button1_Click" and a Button1_Click event to call it:<o:p></o:p>

        Protected Sub Button1_Click(sender As Object, e As EventArgs)<o:p></o:p>

            UpdateUser()<o:p></o:p>

        End Sub<o:p></o:p>

    <o:p> </o:p>

        Public Sub UpdateUser() 'This works too!<o:p></o:p>

            Dim ThisUser As String = User.Identity.Name<o:p></o:p>

            Dim udFirstName As TextBox = UserDetails.FindControl("ThisUserFirstName")<o:p></o:p>

            Dim udLastName As TextBox = UserDetails.FindControl("ThisUserLastName")<o:p></o:p>

            Dim udDepartment As TextBox = UserDetails.FindControl("ThisUserDepartment")<o:p></o:p>

            Dim udInstitution As TextBox = UserDetails.FindControl("ThisUserInstitution")<o:p></o:p>

            Dim db As New UserContext()<o:p></o:p>

    <o:p> </o:p>

            Try<o:p></o:p>

                Dim UserRecord = (From c In db.UserInfoes Where c.Username = ThisUser Select c).FirstOrDefault()<o:p></o:p>

                If UserRecord IsNot Nothing Then<o:p></o:p>

                    UserRecord.FirstName = udFirstName.Text<o:p></o:p>

                    UserRecord.LastName = udLastName.Text<o:p></o:p>

                    UserRecord.Department = udDepartment.Text<o:p></o:p>

                    UserRecord.Institution = udInstitution.Text<o:p></o:p>

                    db.SaveChanges()<o:p></o:p>

                End If<o:p></o:p>

            Catch exp As Exception<o:p></o:p>

                Throw New Exception("ERROR: Unable to Update User Info - " & exp.Message.ToString(), exp)<o:p></o:p>

            End Try<o:p></o:p>

        End Sub<o:p></o:p>

    Wednesday, January 3, 2018 9:59 PM