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.0DataList not bindingDataList not binding
Previous
 
Next
New Post
6/20/2007 7:39 AM
 

I'm going mad here so I hope someone can help me out.

I have used DNN in the past but this is my first look at developing a custom module.

I have a working (source) installation of DNN and have installed the Module templates into Visual Web Developer Express. After working through the GuestBook tutorial and getting this working without any great problems I decided to create a module as a training exercise for myself. The UI would be pretty similar to the GuestBook but oulling data from my tables/s-procs. I generated the necessary files using the template and then set about creating my table and stored procedures. I have updated the DataProvider and SqlDataProvider classes as well as the Controller/Info files. All seemed to be going well at this point.

I have updated the DataList in the UI as required to display the information but when I Build/Debug and view the page all I get is a list of [CONTENT] records being displayed in place of the actual data.

I have added a label to the page and linked this to the same data source as the datalist and it shows that the data is being pulled out correctly. I have compared each of my files with the coresponding one in the GuestBook example and I cannot locate the error.

I'm probably going to junk this test module and start again but I sat there for hours last night trying to sort this out and I hate not understanding why something is not working.

I have screenshots and code available if needed.

Thanks in advance.

 
New Post
6/20/2007 10:01 AM
 

Sounds like you're not assigning a value to a control in your datalist.  I use the ItemDataBound event in code behind in similar situatuations (i.e. repeater control).  The MSDN docs should have an example - search for DataList.ItemDataBound Event. 

 
New Post
6/21/2007 3:36 AM
 

Thanks for your response.

The .ascx was generated by the Template and does have an ItemDataBound event (below) which is fired (if I put a label on the page and assign it a value in this method it does display). It's obviously not assigning the value but as I'm still finding my way around the inner workings of DNN I cannot see what it is doing.

        Protected Sub lstContent_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles lstContent.ItemDataBound
            Dim strContent As String = strTemplate
            Dim strValue As String

            ' add content to template
            Dim objProperties As ArrayList = Common.Utilities.CBO.GetPropertyInfo(GetType(DNNTest1Info))
            Dim intProperty As Integer
            Dim objPropertyInfo As PropertyInfo
            For intProperty = 0 To objProperties.Count - 1
                objPropertyInfo = CType(objProperties(intProperty), PropertyInfo)
                If strContent.IndexOf("[" & objPropertyInfo.Name.ToUpper & "]") <> -1 Then
                    strValue = Server.HtmlDecode(DataBinder.Eval(e.Item.DataItem, objPropertyInfo.Name).ToString())
                    strContent = strContent.Replace("[" & objPropertyInfo.Name.ToUpper & "]", strValue)
                End If
            Next intProperty

            ' assign the content
            Dim lblContent As Label = CType(e.Item.FindControl("lblContent"), Label)
            lblContent.Text = strContent
        End Sub

I suppose this is one of the problems with using Templates - you really don't know what is going on and if you want to do something slightly different then you have to dig deeper.

If you can spot the problem in the above then please let me know.

Cheers

 

 
New Post
6/21/2007 10:44 AM
 

Looking at this code - I would guess that strTemplate = "[CONTENT]" and you are actually assigning a value to your label (just not the one you want).

I suggest ensuring objProperties is being populated and includes a property named "Content".

Good luck.

 
New Post
6/21/2007 2:04 PM
 

Oh what a muppet I am . The original template had a field called Content which I had replaced with my own field. Changing the Template.Text value to [RECORDTEXT] in the resource file sorted it.

I've taken a look at the DAL+ method of module development and this makes more sense to me than the template does. I've already created a module using the tutorial and created the test one that I wanted to experiment with.

Thanks for your input!

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0DataList not bindingDataList not binding


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