I have the code:
Code Behind .vb file:
Dim lbAsNew LinkButtonlb.Text = dt.Rows(j).Item(
0)lb.ID =
"cat" +CType(dt.Rows(j).Item(1),String)lb.CssClass =
"lbH1"lb.OnClientClick =
"lb_Click('" +CType(dt.Rows(j).Item(1),String) +"')"tc.Controls.Add(lb)
Client Side .aspx file:
<scriptlanguage="javascript"type="text/javascript">function lb_Click(e){alert(e);
}
</script>How can I tie this code in to talk to a Page Method or WebService? Any good simple links/tutorials? I tried the Ajax video page but apparently the sound drops out half way through the video? And my books refer to 'Atlas' instead of 'Ajax 1 or 2'.
You can add a onclick event handler like this:
AddHandler lb.OnClick, AddressOf lb_Click
And define a event handler method as below:
Protected Sub lb_Click(sender as object, E as EventArgs)
End Sub
If want to execute it asynchronously, you can decorate the above method with WebMethod attribute. Like this:
<WebMethod()> Protected Sub lb_Click(sender as object, E as EventArgs)
End Sub
No comments:
Post a Comment