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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Module Title ?Module Title ?
Previous
 
Next
New Post
4/25/2008 11:23 AM
 

Hi all,

Before I explain the question, let me explain what I have setup so far. I have a single Module Definition with three controls defined:

Key Type Title SourcePage (abbreviated)
  View Items ViewItems.ascx
Edit Edit Edit Item EditItems.ascx
Settings Edit Item Settings ItemSettings.ascx

 In the ViewItems.ascx, I add a custom action in the usual event handler. The only "pertinent" code in that handler is:

Dim Actions As New Entities.Modules.Actions.ModuleActionCollection"", "", EditUrl(), False, Security.SecurityAccessLevel.Edit, True, False)

Return

 So, When I add the module to an actual page, the default View controntrol is displayed, and its Title is "Items" (as expected and desired)

When I hover over the action menu, I get an option for "Add Item" (as expected and desired)

When I click the Edit link for one of the Items, I see the Edit Control displayed, and all the fields filled in and the Title of the Module is "Edit Item" (as expected and desired)

However, if I click on "Add Item" from the View Control, I am put onto the Edit Control with all the fields being blank (as expected), but the Title of the module is "Edit Items"......which is not what I want.  I want it to be "Add Item"

If I change the title in the control definition it affects both modes so that won't work.

I've read the previous posts about how to change the module title in the Page_Load event etc, but what I am unclear on is how I know whether I am "Adding" or "Editing" at any given time.

Would it be simpler to actually make two different control definitions with different titles, but using the same .ascx page?

I appreciate any guidance all you experts can provide!

Thanks

Paul Hermans

 

 

 

 Public ReadOnly Property ModuleActions() As Entities.Modules.Actions.ModuleActionCollection Implements Entities.Modules.IActionable.ModuleActionsGet

ActionsEnd GetEnd Property

 
New Post
4/25/2008 5:07 PM
 

Paul Hermans wrote

I've read the previous posts about how to change the module title in the Page_Load event etc, but what I am unclear on is how I know whether I am "Adding" or "Editing" at any given time.

 

Have you tried to change title in Page_Init instead of Page_Load in the Edit.ascx.vb? 

Try this:  Add a resource record for page title in the Edit.resx file and read the title from resource file at runtime and set the control title in page_init event. 


Fuji Nguyen
FREE Visitor Hit Counter
Visit opensource.indyneinc.com for detail.
 
New Post
4/25/2008 6:57 PM
 

Paul,

Most of the time I just determine the mode by looking at the value of the primary key field that is passed to the Edit control from the View control. Typically, when you click on the edit icon of an exiting record you pass the record id of the record clicked and when you click the "Add Record" link you pass a -1. If you have a table with a key field called "ItemId" you could do something like this in your Edit control in the Page_Load...

Visual Basic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
If Not (Request.Querystring("ItemId") Is Nothing) Then
ItemID = Int32.Parse(Request.Querystring("ItemId"))
End If

If ItemId = -1 then
'-- Add mode.
Me.ModuleConfiguration.ModuleTitle = Localization.GetString("AddMode.Text", LocalResourceFile)
Else If ItemId > 0 then
'-- Edit mode.
Me.ModuleConfiguration.ModuleTitle = Localization.GetString("EditMode.Text", LocalResourceFile)
Else
'-- Invalid ItemId so just return.
Response.Redirect(NavigateURL(), True)
End If

This presumes you have entered the following entries in the resource file for your edit control... AddMode.Text "Adding Item" EditMode.Text "Editing Record" I hope this helps, Chuck R.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Module Title ?Module Title ?


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