Add record to dataset

Hi experts,

Here is the code I use to load records from sql to a dropdownlist. What should I do to load a record ("test","0")  in first position.      

Article1.DataSource = ds.Tables(0)
        Article1.DataTextField = HttpUtility.HtmlDecode(ds.Tables(0).Columns("Title").ColumnName.ToString())
        Article1.DataValueField = ds.Tables(0).Columns("ArticleId").ColumnName.ToString()
        Article1.DataBind()
        Article1.SelectedValue = Bnews(0)

Thanks
cabouAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
I think you need something like this:
Dim dt As DataTable = ds.Tables(0)
Dim r as DataRow = dt.NewRow()
r("Title") = "Test"
r("ArticleId") = 0
dt.Rows.Add r 
Dim dv as DataView = dt.DefaultView
dv.Sort = "ArticleId ASC" 
        Article1.DataSource = dv
        Article1.DataTextField = "Title"
        Article1.DataValueField = "ArticleId"
        Article1.DataBind()
        Article1.SelectedValue = Bnews(0)

Open in new window

0
All Courses

From novice to tech pro — start learning today.