I read the help on which says:
The ClientScriptMan ager class is used to manage client-side scripts and add
them to Web applications...
But could use a little help. Can someone tell me what the code below is used
for?
If you could just put a few comments into the code that would help.
Is this code requires when ever the <scripttag is used?
The last line appears to relate to the following, but what does it do?
<asp:Image ID="MasterChurc hImage" runat="server" AlternateText=" Church
Image" ImageUrl="~/Images/MasterChurchIma ge.jpg" />
THANKS for any insight
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s)
Handles Me.Load
Dim csname2 As String = "ButtonClickScr ipt"
Dim cstype As Type = Me.GetType()
Dim cs As ClientScriptMan ager = Page.ClientScri pt
' Check to see if the client script is already registered.
If (Not cs.IsClientScri ptBlockRegister ed(cstype, csname2)) Then
Dim cstext2 As New StringBuilder()
cstext2.Append( "<script type=text/javascriptfunct ion DoClick() {")
cstext2.Append( "Form1.Message. value='Text from client script.'} </")
cstext2.Append( "script>")
cs.RegisterClie ntScriptBlock(c stype, csname2, cstext2.ToStrin g(), False)
End If
MasterChurchIma ge.Attributes.A dd("onload", "resizeImg( '" +
MasterChurchIma ge.ClientID + "')")
End Sub
The ClientScriptMan ager class is used to manage client-side scripts and add
them to Web applications...
But could use a little help. Can someone tell me what the code below is used
for?
If you could just put a few comments into the code that would help.
Is this code requires when ever the <scripttag is used?
The last line appears to relate to the following, but what does it do?
<asp:Image ID="MasterChurc hImage" runat="server" AlternateText=" Church
Image" ImageUrl="~/Images/MasterChurchIma ge.jpg" />
THANKS for any insight
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s)
Handles Me.Load
Dim csname2 As String = "ButtonClickScr ipt"
Dim cstype As Type = Me.GetType()
Dim cs As ClientScriptMan ager = Page.ClientScri pt
' Check to see if the client script is already registered.
If (Not cs.IsClientScri ptBlockRegister ed(cstype, csname2)) Then
Dim cstext2 As New StringBuilder()
cstext2.Append( "<script type=text/javascriptfunct ion DoClick() {")
cstext2.Append( "Form1.Message. value='Text from client script.'} </")
cstext2.Append( "script>")
cs.RegisterClie ntScriptBlock(c stype, csname2, cstext2.ToStrin g(), False)
End If
MasterChurchIma ge.Attributes.A dd("onload", "resizeImg( '" +
MasterChurchIma ge.ClientID + "')")
End Sub
Comment