Question

I am using AJAX TabContainer and have an asp GridView in each tab which is bound to an ObjectDataSource. The ObjectDataSource returns different objects based on the tab selected (TabContainer AutoPostBack="True"). I bind the ObjectDataSource to the GridView based on the tab selected during TabContainer Load in the code behind only if IsPostBack because on the first load the TabContainer is not visible. I do not bind the GridView anywhere else. The fields in the GridView are Eval instead of Bind because the parameters are added to the ObjectDataSource dinamically.

This is a bulk update GridView with all of the fields editable. When I update the GridView, I am not able to see e.OldValues. If the fields in the GridView are set to Bind, I am able to retrieve e.NewValues nut e.OldValues is still empty...

Does anyone know what the deal is?

<asp:ObjectDataSource ID="odsEquipment" runat="server" TypeName="EquipmentDB" SelectMethod="GetEquipment" SortParameterName="sortExpression" UpdateMethod="UpdateEquipment">
    <SelectParameters>
        --Params
    </SelectParameters>
    <UpdateParameters>
        --Params
    </UpdateParameters>
</asp:ObjectDataSource>


<asp:TabContainer ID="tcDisciplines" runat="server" CssClass="ajax_tabController" ScrollBars="Horizontal" AutoPostBack="True">
--Tabs and GridViews with no properties

Code Behind:

Protected Sub tcDisciplines_Load(sender As Object, e As EventArgs) Handles tcDisciplines.Load
    If IsPostBack Then
        For Each discipline In disciplineList
            tcDisciplines.Tabs(discipline.ID).HeaderText = discipline.Discipline
            tcDisciplines.Tabs(discipline.ID).TabIndex = discipline.ID

            Dim gv As GridView = TryCast(tcDisciplines.Tabs(discipline.ID).Controls(0).FindControl("gv" + discipline.Abbr), GridView)
            gv.Visible = False

            If tcDisciplines.ActiveTabIndex = discipline.ID Then
                gv.Visible = True

                'Set properties
            End If
        Next
    End If
End Sub
Was it helpful?

Solution

Found a little tutorial on MSDN, http://msdn.microsoft.com/en-us/library/aa992036.aspx#Y3473 This work-around helped me. I used a session instead with a list of rows.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top