Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...VIEW.ASCX Not DisplayingVIEW.ASCX Not Displaying
Previous
 
Next
New Post
12/19/2012 8:21 PM
 

Stupid question:  Am I supposed to add some code to the EDIT.ASCX.CS file to get the PAGE_LOAD subroutine to work correctly on the initial load ???

Here it is in its entirety:

*******************************************************************************************************************************************************************

/// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// -----------------------------------------------------------------------------
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                //Implement your edit logic for your module
                if(!Page.IsPostBack)
                {
                    ddlAssignedUser.DataSource = UserController.GetUsers(PortalId);
                    ddlAssignedUser.DataTextField = "Username";
                    ddlAssignedUser.DataValueField = "UserId";
                    ddlAssignedUser.DataBind();

                    if(TaskId>0)
                    {
                        var task = TaskController.GetTask(TaskId);
                        if(task!=null)
                        {
                            txtName.Text = task.TaskName;
                            txtDescription.Text = task.TaskDescription;
                            txtTargetCompletionDate.Text = task.TargetCompletionDate.ToString();
                            txtCompletionDate.Text = task.CompletedOnDate.ToString();
                            ddlAssignedUser.Items.FindByValue(task.AssignedUserId.ToString()).Selected = true;
                        }
                    }
                }


            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }

*******************************************************************************************************************************************************

It looks like I would have to initialize TaskId to 0 at the top of the loop, then increment it by 1 after each successful find.

Perhaps this is why I'm not getting any data ???

Jeff

 

 
New Post
12/19/2012 11:48 PM
 

The Page_Load handler that you posted is that for Edit.ascx which both creates new tasks in the database AND allows one to edit an existing task. The TaskID property (which is defined in TaskManagerModuleBase.cs from which Edit.ascx.cs inherits) picks up its value from the "tid" querystring parameter that is passed to the edit control (from the view controll). If TaskID <= 0 then a new task is being created. If it is > 0 then a previously created task is read from the database and displayed for editing.

You mentioned earlier that new tasks are being added to the database so I would have to assume that the Edit.ascx control is working properly and that the issue of no tasks being displayed lies in the databinding code in Page_Load handler of View.ascx.cs or more likely in the TaskController.GetTasks method which should return a List of Task objects from the database.

Without seeing your complete code and without your being able to set a breakpoint in the Page_Load method of View.ascx.cs I can't offer too many more suggestions. Have you looked at the presumably working source code for the complete TaskManager project available from CodePlex (http://dnntaskmanager.codeplex.com) and compared it with the code you entered while working through the video series?

In lieu of being able to debug the project in Visual Web Designer you could also try adding the following markup at the very end of View.ascx

<asp:Label id="lblMessage" runat="server"></asp:Label>

and change the Page_Load handler code of View.ascx.cs to

        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                var tasks = TaskController.GetTasks(ModuleId);
                lblMessage.Text = "Tasks loaded: " + tasks.Count.ToString();
                rptTaskList.DataSource = tasks;
                rptTaskList.DataBind();
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }

After you compile the project and browse to the page containing the Task Manager module in your test site you should be able to see "Tasks Loaded: #" where # is the count of tasks read from the database. We'll then know if the Page_Load handler is being called and if tasks are being loaded from the database. You can then experiment with displaying other information to the lblMessage label control.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
12/20/2012 1:38 PM
 

I will add the code you suggested this afternoon and let you know how it goes.

Jeff

 

 
New Post
12/20/2012 1:42 PM
 

I've been relying exclusively on the http://dnntaskmanager.codeplex.com source code since mid-way thru the video series when entering the code manually got so onerous and someone clued me in to the presence of the source code at the above location.

I will check the TASKCONTROLLER code again to see if something is askew.

Jeff

 

 

 
New Post
12/20/2012 2:05 PM
 

THANKS for the info about the lblMessage label control.

I had been searching for a method to display information in much the same manner as the COBOL "DISPLAY" statement.

Jeff

 
Previous
 
Next
HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...VIEW.ASCX Not DisplayingVIEW.ASCX Not Displaying


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out