FormView

FormView

Old forum URL: forums.lhotka.net/forums/t/3447.aspx


dantes1 posted on Tuesday, August 28, 2007

i have a from view and set its datasourceid to a datasouce i made...

on the InsertItemTemplate when clicking the link button ("Insert")... i was expecting that it would call the method handling the InsertObject event of the csladatasource...

but it did not... why is this???

RockfordLhotka replied on Wednesday, August 29, 2007

I would expect that too Smile [:)]

Does the SelectObject event get raised as expected? Are you sure you have the InsertObject event handler wired up properly?

dantes1 replied on Thursday, August 30, 2007

i was  able to correct it... i have this code i wanna share... i got this from the telerik website... coz im doing web apps now (telerik controls and CSLA BO's)...

before the formview was working, i commented the line with "This one" on the end...

then i tried to uncomment it compiled and run it... and the eventhandler for the InsertObject event worked after i clicked the button with  "Insert" as its CommandName...

to be honest i did not know why... is there any chance that you could explain to me what that code does???

Protected Overrides Sub RaisePostBackEvent(ByVal source As IPostBackEventHandler, ByVal eventArgument As String)

        MyBase.RaisePostBackEvent(source, eventArgument) ---- This one

        If TypeOf source Is Telerik.WebControls.RadGrid Then
            Dim frmv As FormView = Nothing

            frmv = CType(Me.FindControl("formview1"), FormView)
            Dim radG2 As Telerik.WebControls.RadGrid = CType(frmv.FindControl("RadGrid2"), Telerik.WebControls.RadGrid)

            Select Case eventArgument
                Case "Rebind"
                    radG2.MasterTableView.SortExpressions.Clear()
                    radG2.MasterTableView.GroupByExpressions.Clear()

                    radG2.Rebind()
                  

                Case "RebindAndNavigate"
                    radG2.MasterTableView.SortExpressions.Clear()
                    radG2.MasterTableView.GroupByExpressions.Clear()
                    radG2.MasterTableView.CurrentPageIndex = radG2.MasterTableView.PageCount - 1
                    radG2.Rebind()
            End Select
        End If
    End Sub

Copyright (c) Marimer LLC