I would like to use the XmlHttpPanel to display some content and I am trying to minimise server load.
I have a set of imagebuttons within a repeater control. Its the first time I've used the XmlHttpPanel. The XmlHttpPanel displays information from a specific database record defined by InfoId. I can set the repeater datasource with information containing InfoId. I could set the commandArgument for the buttons to '<%# Eval("InfoId") %>' but that would then involve a postback to execute an OnCommand event. I therefore assume that it would be more efficient (a little like the First Look example in the demos) to have the imagebutton OnClientClick execute a javascript function that then sets the XmlHttpPanel value to the correct InfoId and the panel can then get the required information.
I have two questions: (1) am I write that dealing with the button click in javascript rather than a command postback would be more efficient and (2) that being the case can someone help me with how to set the OnClientClick property of the imagebutton in the repeater. I keep getting messages that the tag isn't well formed or some other error.
I'm assuming that the following javascript is fine (and it works if I hard code the OnClientClick property for a button):
<script type="text/javascript">
function myClientClick(index)
{
var myControl = $find("<%= myXmlHttpPanel.ClientID %>");
myControl.set_value(index);
return false;
}
</script>
However, to make this work I need the OnClientClick property to be of the form: "return OnAdditionalSelect('x')" where x is the InfoId. If I use Eval("InfoId") I get errors and putting \' to try to get the single quotes around the id also causes a "tag not well formed" error.