CodeCharge Studio

Programmatically Control Field's Value

Once you add Custom Code to the Event, you will see the code-editing window with the appropriate place to enter the new code.

  1. Replace this line of code:

    C#

    // Write your own code here.

    VB.Net

    ' Write your own code here.

    with the following lines:

    C#

    if((DataItem.user_id_assign_to.Value).ToString() == DBUtility.UserLogin )
    {
      taskstask_name.Text = "<b><font color='blue'>" + (DataItem.task_name.Value).ToString() + "</b></font>";
    }

    VB.Net

    If DataItem.user_id_assign_to.Value = DBUtility.UserLogin Then
     taskstask_name.Text = "<b><font color='blue'>" & taskstask_name.Text  & "</b></font>"
    End if
    

The following is an explanation of how the code added above works:

The if condition is true only if the grid field task_name (containing the login name of the user to whom the task is assigned) is equal to the login name of the employee that is currently logged into the system. Therefore, once you login to the system, the program will recognize your tasks by comparing your name to the name of the person that each task is assigned to.

C#

taskstask_name.Text = "<b><font color='blue'>" + (DataItem.task_name.Value).ToString() + "</b></font>";

VB.Net

taskstask_name.Text = "<b><font color='blue'>" & taskstask_name.Text & "</b></font>"

This code is executed if the previous if condition is met. It modifies the value of the tasktask_name Label. The field value is replaced with the login name value wrapped within HTML code that specifies the font color as blue, and adds HTML <b> tag to make the font bold as well.

Next: Preview the Tasks List Page


On-line, printable versions and updates