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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModuleswarnings preventing compilingwarnings preventing compiling
Previous
 
Next
New Post
1/27/2010 9:10 AM
 

I am trying to get null values to show on my Grid View as a blank. The only issue I am having this with is Dates and Integers (Dates show up as 1/1/0001 and integers are showing up as -1) I created a function to convert any null date into a blank space. But when I try to compile it wont. There are no errors just a few warnings. The code I am using is the following:

On the aspx page: (I truncated almost all of the Grid View code as it is very large)

            <ItemTemplate>
                <asp:Label ID="Label2" runat="server" Text='<%# MakeNullBlank(Bind("DateOfBirth")) %>' ></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>

 

And my function in the aspx.vb codebehind file

        Public Function MakeNullBlank(ByVal sDate As String) As String
            If sDate Is Nothing Or sDate = "1/1/0001 12:00:00 AM" Or sDate = "12:00:00 AM" Then
                MakeNullBlank = ""
            Else
                MakeNullBlank = sDate
            End If
            Return MakeNullBlank
        End Function

 

The warnings I get are all intellisense warnings and one about SynchronizeModule()

Warning    1    'Public Sub SynchronizeModule()' is obsolete: 'This method is deprecated.  Plaese use ModuleController.SynchronizeModule(ModuleId)'.    

Warning    5    Errors occurred while compiling the Xml schemas in the project.  Because of this, Xml intellisense is not available.    C

But if I take out the call to my function in the aspx page the page compliles correctly:

            <ItemTemplate>
                <asp:Label ID="Label2" runat="server" Text='<%# Bind("DateOfBirth") %>' ></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
  
Am I calling the function in some incorrect way that is causing this to happen? Any help would be greatly appreciated.

Chris

 

 
New Post
1/27/2010 12:23 PM
 

I believe reather than <%# you should be using <%+.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
1/27/2010 1:08 PM
 

Hi Mitch,

Thanks for your help. I tried what you said and the website compiled but the value for the date field was showing up as <%+ MakeNullBlank(Bind("DateOfBirth")) %>

Then I remembered something and realized that what I needed was Eval and not Bind so I tried:

'<%# MakeNullBlank(Eval("DateOfBirth")) %>'

and it worked perfectly!

Thanks again,

Chris

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModuleswarnings preventing compilingwarnings preventing compiling


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