This is a migrated thread and some comments may be shown as answers.
javascript issue when used with Q2 2008
3 Answers 24 Views
This is a migrated thread and some comments may be shown as answers.
Vaibhav
Top achievements
Rank 1
Vaibhav asked on 13 Nov 2008, 08:29 AM
Hi,

Following code does not work with Q2 2008:

code behind:
inside page load -
btnUpdate.Attributes.Add("onClick", "return validate('save');")
btnLoadGrid.Attributes.Add("onClick", "return validate('loadgrid');")
txtNoOfRows.Attributes.Add("onkeyup", "return EnableDisableBttns();")

<telerik:RadAjaxManager ID="AjaxMgr" runat="server" UpdatePanelsRenderMode="inline">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnLoadGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="dgrdSeed" />
                    <telerik:AjaxUpdatedControl ControlID="rcb" />
                    <telerik:AjaxUpdatedControl ControlID="btnUpdate" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="dgrdSeed">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="dgrdSeed" />
                    <telerik:AjaxUpdatedControl ControlID="txtNoOfRows" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnCancel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rsb" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnUpdate">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lblErr" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        
        
    </telerik:RadAjaxManager>



What happens is:
1) javascript function gets called but corresponding click event on code behind of buttons is not firing on returning true which was working fine with Q2 2007. I tried using radcodeblock, radscriptblock.
2) validation controls does not fire expected.

Any help please.

Thanks,
Vaibhav

3 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 13 Nov 2008, 08:33 AM
Hello Vaibhav,

Here is an example how to achieve your goal:

btnUpdate.Attributes.Add("onClick", "if(!validate('save')) return false;")
btnLoadGrid.Attributes.Add("onClick", "
if(!validate('loadgrid')) return false;")
txtNoOfRows.Attributes.Add("onkeyup", "
if(!EnableDisableBttns()) return false;")


Best wishes,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Vaibhav
Top achievements
Rank 1
answered on 13 Nov 2008, 09:29 AM
Hi,

I have a grid and first column of last row has a LinkButton test is '*'. When I click on * another row gets added to grid, same as access table.
I have ajaxified most of things, but this *.

On click of * I want to enable Save button. How do I achieve following in code behind.

<AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="*">
                <UpdatedControls>
                          <telerik:AjaxUpdatedControl ControlID="btnUpdate" />
                </UpdatedControls>
            </telerik:AjaxSetting>
</AjaxSettings>

I think code to be written in item created event of grid.
What is code to make settings?

Thanks,
Vaibhav
0
Vaibhav
Top achievements
Rank 1
answered on 13 Nov 2008, 11:22 AM
Hi,

I solved it by following code:

Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
        Dim lbtnNew As New LinkButton
        lbtnNew = CType(dgrdSeed.Items(hidNoOfRows.Value - 1).FindControl("link0"), LinkButton)
        AjaxMgr.AjaxSettings.AddAjaxSetting(lbtnNew, btnUpdate)
        AjaxMgr.AjaxSettings.AddAjaxSetting(lbtnNew, btnLoadGrid)
        AjaxMgr.AjaxSettings.AddAjaxSetting(lbtnNew, dgrdSeed)
        AjaxMgr.AjaxSettings.AddAjaxSetting(lbtnNew, hidNoOfRows)
End Sub

Regards,
Vaibhav
Tags
Ajax
Asked by
Vaibhav
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Vaibhav
Top achievements
Rank 1
Share this question
or