Saturday, March 24, 2012

Need help adding item from a gridview to a Reorderlist programmically

I have a GridView which I programmically bound to a DataTable.

I also have a ReOrderlist which I've done the same.

I'm trying to have the user click "Add" on the gridview and it adds that row to the Reorderlist.

How can I do I this?


I was trying to pull back out the datasource fom the reorderlist and then add a datarow somehow and then send it back. But I get an object error on that, still working it out.


I'd rather somehow use the .Items.Add(xxx) method, but I don't know how to properly populate it. It wants a RorderListItem, fine, but the ReorderListItem wants a DataItem and I don't know where to get that.

Pretty confused.


Ok I was able to figure it out, I had to reload my datasource on post back before trying it out.

I'd rather do it using Me.QualificationReorderList.Items.Add() somehow, but instead, I pull back the datasource, add a row to it and then re-bind it.

1If e.CommandName.Equals("Add")Then2 Call LoadReorderListItems()34Dim TempReorderListDataTableAs New Data.DataTable5 TempReorderListDataTable =Me.QualificationReorderList.DataSource67Dim TempDataRowAs Data.DataRow89 TempDataRow = TempReorderListDataTable.NewRow1011 TempDataRow.Item("CERTIFICATION_ID") = 123412 TempDataRow.Item("CERTIFICATION_TITLE") ="12"13 TempDataRow.Item("DISPLAY_ORDER") = 01415 TempReorderListDataTable.Rows.Add(TempDataRow)1617Me.QualificationReorderList.DataSource = TempReorderListDataTable18Me.QualificationReorderList.DataBind()19End If

No comments:

Post a Comment