SQLDataSource?

Last post 04-11-2006, 11:19 PM by [email protected]. 3 replies.
Sort Posts: Previous Next
  •  04-05-2006, 9:49 AM 17898

    SQLDataSource?

    Has anyone figured out how to bind the editor to a SqlDataSource object?  The only way I've figured out how to do this (thus far) is to bind to a Literal control and then set the editor's text to what's in the Literal.  Rather goofy, but it works.  I think it's causing some performance issues however, and would much rather bind directly to the editor control.
     
     
  •  04-11-2006, 8:53 PM 18127 in reply to 17898

    Re: SQLDataSource?

    I must be the only person here that needs / want to use a SqlDataSource object to supply content to the Editor? Hmmm.  That's funny.
  •  04-11-2006, 11:17 PM 18133 in reply to 18127

    Re: SQLDataSource?

    Mark,
     
    Can you create a simple example which can demonstrate the problem and send it to me?

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-11-2006, 11:19 PM 18134 in reply to 18127

    Re: SQLDataSource?

    Thanks to the guys over at 4guysfromrolla.com, I finally found some help with this question.  In case other's are wondering how to do this in ASP.NET 2.0 as well... here's a possible solution.

    Protected
    Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Try
            'Programmatically access the SqlDataSource - get back a DataView
            Dim dv As DataView = CType(Me.SqlDataSourceContent.Select(DataSourceSelectArguments.Empty), DataView)
            Dim strContentTest As String
            Dim dr As DataRow
            If dv.Table.Rows.Count > 0 Then
                   dr = dv.Table.Rows(0)
                strContentTest = dr(
    "Your_Field_Name_Here").ToString()
                Me.Editor1.Text = strContentTest
            End If
     
         Catch ex As Exception
            Response.Write(ex.ToString)
         End Try
        End If
    End Sub
View as RSS news feed in XML