Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ClientScript overwrite

Status
Not open for further replies.

mbiro

Programmer
Nov 20, 2001
304
0
0
I have a Sub that I call at the end of my page_load sub:
Code:
    Public Sub pageLook()
        Dim script As New StringBuilder
        ...
        Dim csname1 As String = "startup"
        Dim cstype As Type = Me.GetType()
        Dim cs As ClientScriptManager = Page.ClientScript

        If (Not cs.IsStartupScriptRegistered(cstype, csname1)) Then
            Dim cstext1 As String = script.ToString
            cs.RegisterStartupScript(cstype, csname1, cstext1, True)
        Else
            Dim cstext1 As String = script.ToString
            cs.RegisterStartupScript(cstype, "ff", cstext1, True)
        End If
    End Sub

And it works fine. The problem is that I have a sortable gridview that fires a Sorting event. I need the sub above to fire again when the event is handled, so I call it again from the Sorting event. The problem is that I can't overwrite the registered script (I assume that is why the MSDN example wraps it in the isRegistered if/then as I have above).

If I remove the if/then, it does not overwrite the registered script(although it does run through the sub) I have tried placing the call to the sub in the PreRender event, but the control's sorting event happens after the page prerender. By the way, this is 2.0 and on a content page.

Any ideas on:
1. overwrite the registered script, or
2. call the sub after any events have happened

?

Thnak you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top