Hi guys,
I want to use ASP.NET LinkButton with JavaSript,
i am using Client CallBack without postback,
my javascript is:
<<pre lang="xml">script type="text/javascript">
function ReceiveBikeColor(colorFile)
{
}
<pre lang="cs">public partial class About : System.Web.UI.Page, ICallbackEventHandler
{
protected void Page_Load(object sender, EventArgs e)
{
string cbRef = ClientScript.GetCallbackEventReference(this, "arg", "ReceiveBikeColor", "context");
string cbScript = "function GetBikeColor(arg, context) {" + cbRef + "; }";
ClientScript.RegisterClientScriptBlock(this.GetType(), "GetBikeColor", cbScript, true);
}
public string GetCallbackResult()
{
}
public void RaiseCallbackEvent(string eventArgument)
{
}
}
but when assign onclick attribute to Javascript method like that:
<asp:LinkButton id="lbtnAddToFavorites" runat="server" OnClick="GetBikeColor()" >Add to favorites</asp:LinkButton>
it tell me that:
Error 'ASP.specifictopic_aspx' does not contain a definition for 'GetBikeColor'
and when use OnClientClick attribute it casue Postpack
<asp:LinkButton id="lbtnAddToFavorites" runat="server" OnClientClick="GetBikeColor()" >Add to favorites</asp:LinkButton>