Hello
I am trying to autofill two of the many textboxes in my Radgrid. I want the first textbox to have the username of the logged on user and the other textbox should have current date and time.
With the help of another post I have managed this when creating a new record, but not when editing an existing record.
To be clear, if I edit an existing post I want the textboxes to have new values, current datetime and looged on user.
Here is my code:
Thanks.
I am trying to autofill two of the many textboxes in my Radgrid. I want the first textbox to have the username of the logged on user and the other textbox should have current date and time.
With the help of another post I have managed this when creating a new record, but not when editing an existing record.
To be clear, if I edit an existing post I want the textboxes to have new values, current datetime and looged on user.
Here is my code:
Protected
Sub
RadGrid1_ItemCommand(sender
As
Object
, e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
RadGrid1.ItemCommand
If
(e.CommandName = RadGrid.InitInsertCommandName)
Then
e.Canceled =
True
Dim
loggedInUser = User.Identity.Name.ToString()
Dim
myDate
As
Date
= Now()
Dim
defaultValue
As
System.Collections.Specialized.ListDictionary =
New
System.Collections.Specialized.ListDictionary()
defaultValue(
"LastUpdated"
) = myDate.ToString()
defaultValue(
"LastUpdatedBy"
) = loggedInUser.ToString()
e.Item.OwnerTableView.InsertItem(defaultValue)
End
If
End
Sub
Thanks.