CMS Webcontent based on ID

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2007
Posts: 2
Reputation: dude9er is an unknown quantity at this point 
Solved Threads: 0
dude9er dude9er is offline Offline
Newbie Poster

CMS Webcontent based on ID

 
0
  #1
Apr 24th, 2009
I am trying to update web content on my site by the ID in the database. I am using a ASCX file in order to update the content and it's integrated with a BLL VB file. By example, the content on my Contact page needs to be updated, the DB table has the following columns: id, section (the section that is being updated, in this case "contactpage"), sectionContent, dateStmp and clubId.

I have set it up so that the section column's value can equal "contactpage" with different "clubId" values.

DB Example:

Section | SectionContent | clubId

contactpage | Call me now | NHSC
contactpage | Call me L8tr | ABC123
contactpage | Don't Call | KLM987
contactpage | Upchuck | CHUCK

When I go to update the page I want to grab the clubId=NHSC from the querystring, and update the relevant "sectionContent=Call Me now" column in the DB

Here is the BLL code that already exist, how can I modify it with a where statement club=@club from the querystring

  1. Public Class CMS
  2.  
  3. Public Shared Function GetContent(ByVal sectionname As String) As String
  4. Dim str As String = ""
  5. Dim qry As New Query(Tables.WebContent)
  6. qry.AddWhere(WebContent.Columns.Section, sectionname)
  7. If qry.GetRecordCount() = 1 Then
  8. Dim Content As New WebContent(WebContent.Columns.Section, LCase(sectionname))
  9.  
  10. If Content.IsLoaded Then
  11. str = Content.SectionContent.ToString()
  12. End If
  13. Else
  14. str = "IsNotAdded"
  15. End If
  16. Return str
  17. End Function


I am using FCKeditor, here is the code to update, I need to use the where statement to identify the clubId:

  1. Public Shared OrigionalContent As String = ""
  2. Public Shared IsNew as Boolean = False
  3.  
  4. Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
  5.  
  6. If Not Page.IsPostBack Then
  7. If Request("sectionname") Is Nothing Then
  8. Response.Redirect("~/default.aspx")
  9.  
  10. Else
  11. OrigionalContent = CMS.GetContent(Request.QueryString("sectionname").ToString())
  12. If OrigionalContent = "IsNotAdded" Then
  13. FCKeditor1.Value = "&lt;p&gt;</p>"
  14. IsNew = True
  15. Else
  16. FCKeditor1.Value = OrigionalContent
  17. IsNew = False
  18. End If
  19. End If
  20. End If
  21.  
  22. End Sub
  23.  
  24.  
  25. Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  26. Dim newcontent As String = ""
  27. If FCKeditor1.Value = "" Then
  28. newcontent = "<p></p>"
  29. Else
  30. newcontent = FCKeditor1.Value
  31. End If
  32.  
  33. If OrigionalContent = "IsNotAdded" Or IsNew = True Then
  34. CMS.AddContent(Request.QueryString("sectionname").ToString(), newcontent)
  35. Else
  36. CMS.UpdateContent(Request.QueryString("sectionname").ToString(), newcontent)
  37. End If
  38.  
  39. Dim ip As String = Request.ServerVariables("REMOTE_ADDR")
  40.  
  41.  
  42. If Request("ReturnURL") Is Nothing = False Then
  43. Response.Redirect(CStr(Request("ReturnURL")))
  44. Else
  45. Response.Redirect("~/default.aspx")
  46. End If
  47.  
  48. End Sub

And of course the ASCX code that requires the Where clubId=@clubId statement


  1. Private _Section As String = ""
  2.  
  3. Public Property Section() As String
  4. Get
  5. Section = LCase(_Section)
  6. End Get
  7. Set(ByVal value As String)
  8. _Section = LCase(value)
  9. End Set
  10. End Property
  11.  
  12. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  13. If Section Is Nothing Then
  14. Label_Content.Text = "Please enter a section name into the WebContent control."
  15. Else
  16. Try
  17. sectionnameprop.Value = _Section
  18. Label_Content.Text = ClubStarterKit.Web.CMS.GetContent(_Section)
  19. Catch ex As Exception
  20.  
  21. End Try
  22. Edit.Visible = Page.User.IsInRole("Editors")
  23.  
  24. 'Added this to get the querystring
  25. Dim clubId As String = Request.QueryString("clubId")
  26.  
  27. Dim url As String = "~\WebContent\Editor.aspx?sectionname=" & sectionnameprop.Value
  28. 'and this
  29. url += "&clubId=" & clubId
  30. url += "&ReturnURL="
  31. url += System.Web.HttpUtility.UrlEncode(Request.Url.ToString())
  32. Edit.NavigateUrl = url
  33. End If
  34. End Sub


Thanks everyone, please bare with me as I am new to the asp.net world.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC