I have a ComponentArt CallBack control. Client side, I want to perform a callback using javascript when the dropdown list is changed. In the javascript, I want to explicitly pass both the control and the associated ComponentArt.Web.UI.CallBackEventArgs.
Below is a bare bones implementation of what I'm trying to accomplish on a larger scale.
What do I put in the javascript to explicitly pass the ComponentArt.Web.UI.CallBackEventArg? Assuming this is possible, the part I'm interested in is marked WHAT_DO_I_PUT_HERE.
The ascx control contains:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="foo.ascx.cs" Inherits="WebPlugins.foo" %>
<%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %>
<script language="javascript" type="text/javascript">
function changeDDL(sender) {
alert("This alert pops up. No problems here.");
fooClbk.Callback(sender, WHAT_DO_I_PUT_HERE );
}
</script>
<ComponentArt:CallBack id="fooClbk" runat="server" OnCallback="fooClbk_Callback">
<Content>
<asp:Label ID="lblmyDDL" AssociatedControlID="myDDL" runat="server" Text="Choose an option: "></asp:Label>
<br />
<asp:DropDownList ID="myDDL" runat="server">
<asp:ListItem Value="DEFAULT" Text="The Default Value"></asp:ListItem>
<asp:ListItem Value="ONE" Text="First!"></asp:ListItem>
<asp:ListItem Value="TWO" Text="Runner up"></asp:ListItem>
</asp:DropDownList>
</Content>
<LoadingPanelClientTemplate>
<p>Refreshing Rate Information...</p>
</LoadingPanelClientTemplate>
</ComponentArt:CallBack>
The ascx.cs codebehind contains:
//Some includes...
namespace WebPlugins
{
public partial class foo : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
initializeDDLEvt();
//Initialize some other stuff...
}
private void initializeDDLEvt()
{
/* Register client events for DDL */
myDDL.Attributes.Add("onChange", "changeDDL(this);");
}
protected void fooClbk_Callback(object sender, ComponentArt.Web.UI.CallBackEventArgs e)
{
//Render some new HTML using the ComponentArt.Web.UI.CallBackEventArgs
}
}
}
EDIT: My basic understanding of what was going on here was wrong. I've provided some detail into where I went wrong in a comment below. Thanks @jalpesh for the componentart forum link. This pointed me in the direction I needed to go.