| | |
CMS Webcontent based on ID
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2007
Posts: 2
Reputation:
Solved Threads: 0
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
I am using FCKeditor, here is the code to update, I need to use the where statement to identify the clubId:
And of course the ASCX code that requires the Where clubId=@clubId statement
Thanks everyone, please bare with me as I am new to the asp.net world.
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
ASP.NET Syntax (Toggle Plain Text)
Public Class CMS Public Shared Function GetContent(ByVal sectionname As String) As String Dim str As String = "" Dim qry As New Query(Tables.WebContent) qry.AddWhere(WebContent.Columns.Section, sectionname) If qry.GetRecordCount() = 1 Then Dim Content As New WebContent(WebContent.Columns.Section, LCase(sectionname)) If Content.IsLoaded Then str = Content.SectionContent.ToString() End If Else str = "IsNotAdded" End If Return str End Function
I am using FCKeditor, here is the code to update, I need to use the where statement to identify the clubId:
ASP.NET Syntax (Toggle Plain Text)
Public Shared OrigionalContent As String = "" Public Shared IsNew as Boolean = False Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then If Request("sectionname") Is Nothing Then Response.Redirect("~/default.aspx") Else OrigionalContent = CMS.GetContent(Request.QueryString("sectionname").ToString()) If OrigionalContent = "IsNotAdded" Then FCKeditor1.Value = "<p></p>" IsNew = True Else FCKeditor1.Value = OrigionalContent IsNew = False End If End If End If End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim newcontent As String = "" If FCKeditor1.Value = "" Then newcontent = "<p></p>" Else newcontent = FCKeditor1.Value End If If OrigionalContent = "IsNotAdded" Or IsNew = True Then CMS.AddContent(Request.QueryString("sectionname").ToString(), newcontent) Else CMS.UpdateContent(Request.QueryString("sectionname").ToString(), newcontent) End If Dim ip As String = Request.ServerVariables("REMOTE_ADDR") If Request("ReturnURL") Is Nothing = False Then Response.Redirect(CStr(Request("ReturnURL"))) Else Response.Redirect("~/default.aspx") End If End Sub
And of course the ASCX code that requires the Where clubId=@clubId statement
ASP.NET Syntax (Toggle Plain Text)
Private _Section As String = "" Public Property Section() As String Get Section = LCase(_Section) End Get Set(ByVal value As String) _Section = LCase(value) End Set End Property Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Section Is Nothing Then Label_Content.Text = "Please enter a section name into the WebContent control." Else Try sectionnameprop.Value = _Section Label_Content.Text = ClubStarterKit.Web.CMS.GetContent(_Section) Catch ex As Exception End Try Edit.Visible = Page.User.IsInRole("Editors") 'Added this to get the querystring Dim clubId As String = Request.QueryString("clubId") Dim url As String = "~\WebContent\Editor.aspx?sectionname=" & sectionnameprop.Value 'and this url += "&clubId=" & clubId url += "&ReturnURL=" url += System.Web.HttpUtility.UrlEncode(Request.Url.ToString()) Edit.NavigateUrl = url End If End Sub
Thanks everyone, please bare with me as I am new to the asp.net world.
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: First 4 cases Skipped by if statements
- Next Thread: Help with Dictionary c#
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax appliances application asp asp.net beginner box browser businesslogiclayer button c# c#gridviewcolumn cac checkbox child class compatible confirmationcodegeneration content contenttype control countryselector courier database datagrid datagridview datalist deployment development dgv dialog dropdownmenu dynamic dynamically edit embeddingactivexcontrol feedback fileuploader fill findcontrol flash flv form forms gridview gudi homeedition hosting iis javascript jquery list menu mssql nameisnotdeclared news novell opera order parent problem radio ratings redirect registration relationaldatabases reportemail search security select serializesmo.table sessionvariables silverlight smoobjects software sql sql-server ssl tracking treeview typeof validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming wizard xml xsl





