Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Grids and ObjectDataSources
posted

I'm having a bit of trouble starting with these grids and would love some guidance.  I'm sure I'm just missing something straightforward, but I can't seem to comb through the documentation that tells me exactly what I'm looking for.  So, here goes.

I have a class that contains several subs used for retrieving, editing, deleting, and inserting data into a SQL 2005 database.  All of these things work fine.

I want to put an ObjectDataSource on a .aspx page that refers to Select, Update, Insert, and Delete methods from this class.  I've done this, and it works fine when I wire it up to a tradional .Net 2.0 Form Control for instance.

<asp:ObjectDataSource ID="AttendeeListData" runat="server" TypeName="ErgoWeb.TeamMeeting" SelectMethod="GetTeamMeetingAttendees"
InsertMethod="INSERTTeamMeetingAttendee" UpdateMethod="UpdateTeamMeetingAttendance" >
<SelectParameters>
   <asp:SessionParameter DefaultValue="690" Name="MeetingID" SessionField="EW_MeetingID" Type="Int64" />
</SelectParameters>

<InsertParameters>
   <asp:Parameter Name="MeetingID" Type="Int64" />
<asp:Parameter Name="EmployeeID" Type="Int64" />
</InsertParameters>

<UpdateParameters>
 
<asp:Parameter Name="EmployeeID" />
  <asp:SessionParameter Name="MeetingID" SessionField="EW_MeetingID" />
  <asp:Parameter Name="Attendance" />
</UpdateParameters>


</asp:ObjectDataSource>

So, enter the Grid.  I dropped a grid on the page with the ObjectDataSource and selected the ID of the ODS in the Grid and ran the page.  So far, so good....the data is gathered and displayed.

<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" DataSourceID="AttendeeListData" Height="200px" Width="325px" Browser="Xml" DataKeyField="EmployeeID">

</igtbl:UltraWebGrid>

Next, I wanted a dropdown of choices in one of the columns and to hide some of the others.  I accomplished this as well.

Protected Sub UtraWebGrid1_Initialize(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.LayoutEventArgs) Handles UltraWebGrid1.InitializeLayout

UltraWebGrid1.DisplayLayout.AllowUpdateDefault = UltraWebGrid.AllowUpdate.Yes
UltraWebGrid1.DisplayLayout.CellClickActionDefault = UltraWebGrid.CellClickAction.Edit
UltraWebGrid1.DisplayLayout.Bands(0).Columns(0).Hidden =
True
UltraWebGrid1.DisplayLayout.Bands(0).Columns.FromKey("Attendance").Type = UltraWebGrid.ColumnType.DropDownList

Dim ul As New UniversalLists()
Dim ds As DataSet = ul.GetAttendanceList("en")
Dim dt As DataTable = ds.Tables(0)

UltraWebGrid1.DisplayLayout.Bands(0).Columns.FromKey("Attendance").ValueList.DataSource = dt

UltraWebGrid1.DisplayLayout.Bands(0).Columns.FromKey("Attendance").ValueList.DisplayMember = "NativeTranslation"

UltraWebGrid1.DisplayLayout.Bands(0).Columns.FromKey("Attendance").ValueList.ValueMember = "IndexValue"

UltraWebGrid1.DisplayLayout.Bands(0).Columns.FromKey("Attendance").ValueList.DataBind()

UltraWebGrid1.DisplayLayout.Bands(0).Columns(2).Header.Caption = "Attendee"
UltraWebGrid1.DisplayLayout.Bands(0).Columns(3).Hidden = True

End Sub

 

 

So, I'm ultimately stuck at how to get the changes I make in the dropdown to trigger the Update method in the ObjectDataSoure.  Any thoughts would be greatly appreciated.