RadWindow for Edit RadGridItem

4 posts, 0 answers
  1. MathieuB
    MathieuB avatar
    21 posts
    Member since:
    May 2013

    Posted 23 May 2013 Link to this post

    In my web page (ASP.Net / VB), I have a RadGrid where I bind data on my BD and all my data is displayed correctly. In my grid, I added in each case (row) an Edit button to change my line.
    When I click on my edit button, I call a JS method (client-side) to display my RadWindows.

    function openAddPeriodeDialog() {
                var Rad = $find('<%=RadWindowAddPeriode.ClientID%>');

    It displays correctly. In addition, at my edit button, it calls the ItemCommand (server-side) of my RadGrid to make any adjustments.

    Dim AnneeFinanciere As String = DirectCast(e.Item, GridDataItem).Item("AnneeFinanciere").Text
    txbAnneFianciere.Text = AnneeFinanciere
    panelTypePeriode.Visible = False
    RadGridIntervalle.DataSource = ObjPeriodeComptableController.GridInsertSelect(AnneeFinanciere)

    My problem is that since my RadWindows is responsible for loading the page, I can not change it's worth, I'm tempted to add at my AjaxManager the method for edit action (ID: ImgEdit in my TemplateColumn) refresh my RadWindows, but it does absolutely nothing happens. 

    <telerik:AjaxSetting AjaxControlID="TemplateColumn">
                    <telerik:AjaxUpdatedControl ControlID="RadWindowAddPeriode" />

    I do not know if you have an idea or suggestion that would allow me to "fix" my problem, but if that is the case, I thank you in advance ;) 

    Thank you !

    P.S: Sorry for my English low. 

  2. MathieuB
    MathieuB avatar
    21 posts
    Member since:
    May 2013

    Posted 24 May 2013 Link to this post

    Hi again,
                 For my problem with Refresh my RadWindows, I find the problem. I will try that use RadGridEdit refresh component and it's OK.

    <telerik:AjaxSetting AjaxControlID="RadGridEdit">
            <telerik:AjaxUpdatedControl ControlID="RadGridIntervalle" />
            <telerik:AjaxUpdatedControl ControlID="panelTypePeriode" />
            <telerik:AjaxUpdatedControl ControlID="txbAnneFianciere" />
            <telerik:AjaxUpdatedControl ControlID="rdpDateDebut" />  

    My last problem it's when I click to «Add Button» in my RadWindows. I need to validate the information. If no problem, I add value (it's OK) and close Windows (it's also OK). But I the validation it's don't OK  I need to find How don't close RadWindows.

    I use JS onClick call the closing method.
    Protected Sub makePeriode_Click(sender As Object, e As EventArgs)
        isAddPeriode = False
        RadGridIntervalle_ItemCommand(sender, Nothing)
        If (ObjPeriodeComptableController.Chevauche Is Nothing) Then
            Dim AnneeFinanciere As String = txbAnneFianciere.Text
            For Each Per As PeriodeComptable In ListeNouvellePeriode
                ObjPeriodeComptableController = New PeriodeComptableController(Per.AnneeFinanciere, Per.Periode, Per.DateDebut, Per.DateFin, Per.StatutPeriode)
            Dim script As String = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(closeAddPeriodeDialog);</script>"
            Page.ClientScript.RegisterStartupScript(Me.GetType(), "closeAddPeriodeDialog", script)
            isAddPeriode = True
            'TODO: SI ShowWarning permet une fenetre modal au lieu fenetre timeout
            MainMaster.ShowAlertMessage("Attention!  La période que vous souhaitez modifier entre en collision avec la période " & _
                                        ObjPeriodeComptableController.Chevauche.Periode & " pour l’année financière : " & _
                                        ObjPeriodeComptableController.Chevauche.AnneeFinanciere & ". La modification courante a été annulé," & _
                                        " veuillez corriger la collision et recommencer. ", "Chevauchement Détecté")
            Dim script As String = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(closeAddPeriodeDialog);</script>"
            RadScriptManager.RegisterStartupScript(Me, Me.GetType(), "closeAddPeriodeDialog", script, False)
        End If
    End Sub

    If you have a solution for me ;)

    Thank you.
  3. Marin Bratanov
    Marin Bratanov avatar
    5467 posts

    Posted 27 May 2013 Link to this post

    Hi Mathieu,

    I advise that you examine the following online demo that shows a scenario really similar to yours: http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultvb.aspx?product=window. You can see in the dialog pages how the code-behind is used to validate the content (well, the demo does not do much validation, but the general logic is there) and uses a few conditions in the DetailsView1_ItemCommand that call different JavaScript methods with different arguments. This is what you need to do in your case - if validation is successful call the script that will close the RadWindow, otherwise do something else - call a different script (or with different arguments) or do not call any scripts, but show a message to the user.

    Marin Bratanov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  4. MathieuB
    MathieuB avatar
    21 posts
    Member since:
    May 2013

    Posted 28 May 2013 Link to this post

    I thank for your answer but I find a solution who resolve my problem.

    Dim manager As RadAjaxManager = RadAjaxManager.GetCurrent(Page)

    Thank you !
Back to Top