This is a migrated thread and some comments may be shown as answers.

RadWindow for Edit RadGridItem

3 Answers 45 Views
Window
This is a migrated thread and some comments may be shown as answers.
MathieuB
Top achievements
Rank 1
MathieuB asked on 23 May 2013, 05:57 PM
Hi,
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%>');
            Rad.show();
}

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)
RadGridIntervalle.Rebind()

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">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadWindowAddPeriode" />
            </UpdatedControls>
        </telerik:AjaxSetting>


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 !
Mathieu

P.S: Sorry for my English low. 


3 Answers, 1 is accepted

Sort by
0
MathieuB
Top achievements
Rank 1
answered on 24 May 2013, 12:12 PM
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">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="RadGridIntervalle" />
        <telerik:AjaxUpdatedControl ControlID="panelTypePeriode" />
        <telerik:AjaxUpdatedControl ControlID="txbAnneFianciere" />
        <telerik:AjaxUpdatedControl ControlID="rdpDateDebut" />  
    </UpdatedControls>
</telerik:AjaxSetting>

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)
            ObjPeriodeComptableController.Save(ObjPeriodeComptableController.Entity)
        Next
        ClearRadWindows()
 
        Dim script As String = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(closeAddPeriodeDialog);</script>"
        Page.ClientScript.RegisterStartupScript(Me.GetType(), "closeAddPeriodeDialog", script)
    Else
        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.
0
Marin Bratanov
Telerik team
answered on 27 May 2013, 04:08 PM
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.


Regards,
Marin Bratanov
Telerik
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.
0
MathieuB
Top achievements
Rank 1
answered on 28 May 2013, 02:23 PM
I thank for your answer but I find a solution who resolve my problem.

Dim manager As RadAjaxManager = RadAjaxManager.GetCurrent(Page)
                    manager.ResponseScripts.Add("closeAddPeriodeDialog();")

Thank you !
Tags
Window
Asked by
MathieuB
Top achievements
Rank 1
Answers by
MathieuB
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or