Ticket Q106882
Visible to All Users

how raise grid GetValuesOnCustomCallback event in clientsideevents of itemplate checkbox in master/details grids

created 17 years ago

I'm trying to realize a aspx page to manipulate questionary answers:
- 2 grids master(questions)/details(probably answers)
- in answers_BeforePerformDataSelect I build dataset, assign it to answers grid and I build grid columns also
- in checkbox columns I set:
                Dim Col3 As New DevExpress.Web.ASPxGridView.GridViewDataCheckColumn
                Col3.DataItemTemplate = New Flag
                Col3.Caption = " "
                Col3.VisibleIndex = Ind
                griglia.Columns.Add(Col3)
- Flag class used to itemtemplate are this:
Imports Microsoft.VisualBasic
Imports DevExpress.Web.ASPxGridView
Imports DevExpress.Web.ASPxEditors
Public Class Flag
    Implements System.Web.UI.ITemplate
    Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements System.Web.UI.ITemplate.InstantiateIn
        Dim FlagTest As New ASPxCheckBox
        AddHandler FlagTest.DataBinding, AddressOf Me.BindData
        FlagTest.AutoPostBack = True
        FlagTest.ClientSideEvents.CheckedChanged = "function(s, e) {var c = s.GetChecked(); risposte.GetValuesOnCustomCallback('" & container.UniqueID & "' + ':' + c,null);}"
        container.Controls.Add(FlagTest)
    End Sub
    Public Sub BindData(ByVal sender As Object, ByVal e As EventArgs)
        Dim FlagTest As CheckBox = CType(sender, CheckBox)
        Dim Riga As GridViewDataItemTemplateContainer = FlagTest.NamingContainer
        Dim Griglia As ASPxGridView = Riga.NamingContainer
        Dim RigaDati As DataRowView = Griglia.GetRow(Riga.VisibleIndex)
        FlagTest.Checked = RigaDati.Row("Punt1")
    End Sub
End Class
I need call the GetValuesOnCustomCallback events from right grid because in master/details if I use the code writed in
ClientSideEvents.CheckedChanged I have noted that in ClientSideEvents.CheckedChanged routine the sender grid is always last expanded.
Have you any idea to solve this situation?
Sorry for bad english I hope I've been clear… Thanks in advance for attention

Comments (3)
DevExpress Support Team 17 years ago

    Hi Gianluca;
    I'm afraid, we can't reproduce the issue without a sample project showing this glitch. Please send it to us and we'll do our best to find a solution.
    Thanks
    Kate.

    GM GM
    Gianluca Menichini 17 years ago

      Hi Kate,
      Thank you for quickly replay…
      I solved my problem:
      Moving ClientSideEvents settings row from InstantiateIn to BindData event I can find container objects (using .NamingContainer) of my ITemplate class:
      Public Class Spunta
              Implements System.Web.UI.ITemplate
              '-------------------
              '- ISTANZIA CLASSE -
              '-------------------
              Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements System.Web.UI.ITemplate.InstantiateIn
                  Dim Controllo As New ASPxCheckBox
                  AddHandler Controllo.DataBinding, AddressOf Me.BindData
                  container.Controls.Add(Controllo)
              End Sub
              '------------------------------------------------------------------------------
              '- DATABINDING CONTROLLO PER LETTURA IMPOSTAZIONE STATO E ROUTINE CLIENT SIDE -
              '------------------------------------------------------------------------------
              Public Sub BindData(ByVal s As Object, ByVal e As EventArgs)
                  Dim Controllo As ASPxCheckBox = CType(s, ASPxCheckBox)
                  Dim Riga As GridViewDataItemTemplateContainer = Controllo.NamingContainer
                  Dim Risposte As ASPxGridView = Riga.NamingContainer
                  Dim Domanda As GridViewDetailRowTemplateContainer = Risposte.NamingContainer
                  Dim RigaDati As DataRowView = Risposte.GetRow(Riga.VisibleIndex)
                  Dim Coordinate() As String = Replace(Riga.ID, "cell", "").Split("_")
                  Dim i As Integer = Int(Coordinate(1) / 2)
                  Controllo.ClientSideEvents.CheckedChanged = "function(s, e) {var stato = s.GetChecked(); __doPostBack('Aggiorna_Spunta','" & Domanda.VisibleIndex & "' + ':' + '" & Riga.ID & "' + ':' + stato);}"
                  Controllo.Checked = RigaDati.Row("Punt" & i)
              End Sub
          End Class
      I'd like to know something about a clientsideevents documentation (method and properties of s and e object)…

      DevExpress Support Team 17 years ago

        Hi Gianluca;
        Thank you for your feedback.
        You can get information about ASPxGridView's client-side events from these help topics:
        ASPxGridView GridViewClientSideEvents Members
        Please let me know if this answer is incomplete for you and you have more questions.
        Thanks
        Kate.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.