Re: SQLDataSource?

  •  04-11-2006, 11:19 PM

    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 Complete Thread