Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

GoGrid - Deploy a Windows Server in the Cloud in Minutes!
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
Active Modules -- Active Forums for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

AspDotNetStoreFront - E-Commerce by Design - The Leading ASP.NET shopping cart platform for developers!
Click here to go to dev.live.com for Windows Live developer resources
SteadyRain
DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
Jango Studios - Skins, Modules and Hosting for DotNetNuke
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  FAQ Module [Lea...  FAQ Module: Displaying an Answer on Page Load
Previous Previous
 
Next Next
New Post 4/14/2008 12:33 PM
User is offline David OLeary
92 posts
www.efficionconsulting.com
10th Ranked






FAQ Module: Displaying an Answer on Page Load 

I created a module that will display 3 random FAQ questions. When a user clicks on one of the questions, I want to direct them to the FAQ page with the faqid=x appended to the url and have the answer for that question displayed (along with all the other questions). I've dug through the code to try and figure this out and while all the asp.net stuff makes perfect sense... I just don't get the AJAX stuff and it looks like I need to do some AJAX/Javascript stuff to make this happen. Any ideas for the best way to do this.


David O'Leary
Efficion Consulting
 
New Post 4/14/2008 2:24 PM
User is offline David OLeary
92 posts
www.efficionconsulting.com
10th Ranked






Re: FAQ Module: Displaying an Answer on Page Load 
Modified By David OLeary  on 4/14/2008 5:27:08 PM)

I figured this out. Inside the FAQs.ascx.vb I created a new sub:

       Public Sub ShowFAQOnLoad(ByVal FAQID As integer)

            Try

                Dim controller As New FAQsController
                Dim lblAnswer As Label = Nothing
                Dim dli As DataListItem
                Dim nKey as Integer
                For Each dli In lstFAQs.Items
                    nKey = CInt(lstFAQs.DataKeys(dli.ItemIndex))
                   
                    If nKey = FAQID Then
                        lblAnswer = CType(dli.FindControl("A2"), Label)
                        Exit For
                    End If
                Next
                If lblAnswer Is Nothing Then
                    'Throw New Exception("Unable to find FAQ that matches the supplied ID")
                Else
                    Dim FaqItem As FAQsInfo = controller.GetFAQ(FAQID, ModuleId)
   
                    If (lblAnswer.Text = "") Then
                        IncrementViewCount(FaqItem.ItemId)
                        lblAnswer.Text = HtmlDecode(controller.ProcessTokens(FaqItem, Me.AnswerTemplate))
                    Else
                        lblAnswer.Text = ""
                    End If
                End If
            Catch exc As Exception 'Module failed to load
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub

And then I modified the Page Load and added the following below the BindData():

                    If Request("FAQID") <> "" Then
                        ShowFAQOnLoad(CInt(Request("FAQID")))
                    End If

 


David O'Leary
Efficion Consulting
 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  FAQ Module [Lea...  FAQ Module: Displaying an Answer on Page Load
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Live Visitor Tracking & Live Chat For DotNetNuke
Track your visitors in real time and add live chat for sales & support. Free Trial.
www.whoson.com
SINA101
WANT A SPECial sIte iN TAIWAN?
sina101.com
Web Development and Strategy Firm
The Risdall Interactive Agency s websites, strategies, branding, & promotion in digital space.
www.Risdall.net/

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP