One of the challenges I'm facing involves implementing a callback in my ComponentArt CallBack control using javascript when the dropdown list is changed. I specifically want to pass both the control and the associated ComponentArt.Web.UI.CallBackEventArgs in the javascript code.
Here's a simplified version of what I'm working on:
How can I explicitly pass the ComponentArt.Web.UI.CallBackEventArg in the javascript? To achieve this, I need to figure out WHAT_DO_I_PUT_HERE.
The ascx control includes:
<%@ 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
}
}
}
UPDATE: After gaining a better understanding of the situation, I've made progress by following advice from @jalpesh in the componentart forum link. This has put me on the right track towards solving the issue.