A
AAaron123
I read the help on which says:
The ClientScriptManager 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 <script> tag is used?
The last line appears to relate to the following, but what does it do?
<asp:Image ID="MasterChurchImage" runat="server" AlternateText="Church
Image" ImageUrl="~/Images/MasterChurchImage.jpg" />
THANKS for any insight
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim csname2 As String = "ButtonClickScript"
Dim cstype As Type = Me.GetType()
Dim cs As ClientScriptManager = Page.ClientScript
' Check to see if the client script is already registered.
If (Not cs.IsClientScriptBlockRegistered(cstype, csname2)) Then
Dim cstext2 As New StringBuilder()
cstext2.Append("<script type=text/javascript> function DoClick() {")
cstext2.Append("Form1.Message.value='Text from client script.'} </")
cstext2.Append("script>")
cs.RegisterClientScriptBlock(cstype, csname2, cstext2.ToString(), False)
End If
MasterChurchImage.Attributes.Add("onload", "resizeImg('" +
MasterChurchImage.ClientID + "')")
End Sub
The ClientScriptManager 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 <script> tag is used?
The last line appears to relate to the following, but what does it do?
<asp:Image ID="MasterChurchImage" runat="server" AlternateText="Church
Image" ImageUrl="~/Images/MasterChurchImage.jpg" />
THANKS for any insight
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim csname2 As String = "ButtonClickScript"
Dim cstype As Type = Me.GetType()
Dim cs As ClientScriptManager = Page.ClientScript
' Check to see if the client script is already registered.
If (Not cs.IsClientScriptBlockRegistered(cstype, csname2)) Then
Dim cstext2 As New StringBuilder()
cstext2.Append("<script type=text/javascript> function DoClick() {")
cstext2.Append("Form1.Message.value='Text from client script.'} </")
cstext2.Append("script>")
cs.RegisterClientScriptBlock(cstype, csname2, cstext2.ToString(), False)
End If
MasterChurchImage.Attributes.Add("onload", "resizeImg('" +
MasterChurchImage.ClientID + "')")
End Sub