Let's revisit this:
<asp:Panel runat="server" ID="InnerPanel"></asp:Panel>
We may hand a magic string of "magicstring" into JavaScript like so:
var input = new ASPxImage();
input.ClientInstanceName = "somethingrandom" + DateTime.Now;
input.ClientSideEvents.Init = "function(s,e){{InitTransactionInput(s, 'mymagicstring');}}";
InnerPanel.Controls.Add(input);
We may then doctor up "magicstring" to be "magicstringsomethingmore" in JavaScript and then turn around and hand "magicstringsomethingmore" back into our callback on the C# side.
function InitTransactionInput(s, e) {
alert('whatever');
InnerPanel.PerformCallback(e + 'somethingmore');
}
Some if/then logic would need to exist in the callback's code to "catch" our new value and do something other than just run the code previously ran so that we do not end up in an endless loop.
No comments:
Post a Comment