<telerik:RadAjaxManager runat="server" ID="rdAjaxManager" OnAjaxRequest="rdAjaxManager_AjaxRequest"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="rdAjaxManager"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="rdgdPartnerImportCode"/> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings></telerik:RadAjaxManager>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.
CODE BEHIND using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Telerik.Web.UI; namespace PortalWeb.Partners.Communications { public class Person { public int RecipientID; public string RecipientName; public string RecipientType; public string CompanyName; public string ProgramName; public Person(int RecipientID, string RecipientName, string RecipientType, string CompanyName, string ProgramName) { this.RecipientID = RecipientID; this.RecipientName = RecipientName; this.RecipientType = RecipientType; this.CompanyName = CompanyName; this.ProgramName = ProgramName; } } public partial class recipients : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void RadGrdidRecipientList_Databound(object sender, RadListBoxItemEventArgs e) { // Dummy Data // List<Person> MyData = new List<Person>(); MyData.Add(new Person(1, "John Doe", "OptIn", "FrogJoy", "UIRR")); MyData.Add(new Person(1, "Jane Doe", "OptIn", "YouTube", "TYRR")); MyData.Add(new Person(1, "Jillian Doe", "OptIn", "Intel", "FREE")); MyData.Add(new Person(1, "Happy Joe", "OptIn", "Hello Kitty", "POLG")); MyData.Add(new Person(1, "Rob Crandle", "OptOut", "McDonalds", "NYTH")); RadGrid myFilterGrid = new RadGrid(); myFilterGrid = e.Item.FindControl("RecipientsGrid") as RadGrid; myFilterGrid.DataSource = MyData; myFilterGrid.DataBind(); } } }ASPX PAGE <telerik:RadListBox ID="RecipientFilterList" runat="server" OnItemDataBound="RadGrdidRecipientList_Databound" Width="450px" Height="300px" SelectionMode="Multiple" AllowTransfer="true" TransferToID="RecipientSelectList" AutoPostBackOnTransfer="true" AllowReorder="true" AutoPostBackOnReorder="true" EnableDragAndDrop="true"> <ItemTemplate> <telerik:RadGrid ID="RecipientsGrid" runat="server" AllowFilteringByColumn="True" GroupingSettings-CaseSensitive="false" AllowPaging="True" AllowSorting="True" GridLines="Horizontal" AutoGenerateColumns="false" ShowHeader="true" PageSize="50" MasterTableView-Width="100%"> <HeaderStyle Font-Bold="true" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" ForeColor="#333333" Wrap="False" /> <AlternatingItemStyle BackColor="#EEEEEE" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Wrap="True" /> <MasterTableView AllowFilteringByColumn="True" ItemStyle-Width="100%" NoMasterRecordsText="No Recipients Found" NoDetailRecordsText="No Recipients Found" Visible="true" ShowHeadersWhenNoRecords="true"> <NoRecordsTemplate> <div align="center"> No Recipients Found</div> </NoRecordsTemplate> <Columns> <telerik:GridBoundColumn DataField="RecipientName" HeaderText="Recipients" UniqueName="RecipientName" SortExpression="RecipientName" ShowSortIcon="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="RecipientType" HeaderText="Type" UniqueName="RecipientType" SortExpression="RecipientType" ShowSortIcon="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CompanyName" SortExpression="CompanyName" HeaderText="Companies" UniqueName="CompanyName" ItemStyle-HorizontalAlign="left" ShowSortIcon="false" HeaderStyle-HorizontalAlign="left" HeaderStyle-Wrap="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ProgramName" HeaderText="Programs" UniqueName="ProgramName" ShowSortIcon="false" ItemStyle-HorizontalAlign="Left" SortExpression="NumberContacts"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="RecipientID" Visible="false"> </telerik:GridBoundColumn> </Columns> </MasterTableView> <ClientSettings AllowColumnsReorder="False" ReorderColumnsOnClient="False"> </ClientSettings> </telerik:RadGrid> </ItemTemplate> </telerik:RadListBox> <telerik:RadListBox ID="RecipientSelectList" runat="server" Width="450px" Height="300px" SelectionMode="Multiple" AllowReorder="true" AutoPostBackOnReorder="true" EnableDragAndDrop="true"> <Items> </Items> </telerik:RadListBox>

protected void gvData_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { getData(); } protected void getData() { try { DataSet ds ; //code to get data from database through classes. if (ds != null ) { gvData.DataSource = ds } else { //show error while getting data, contact your system admin } } catch (Exception ex) { //handle exception code } }functionaddNode() {treeView.trackChanges();varnode =newTelerik.Web.UI.RadTreeNode();node.set_text(FeatureNameText.get_value());varparent = treeView.get_selectedNode() || treeView;parent.get_nodes().add(node);if(parent != treeView && !parent.get_expanded())parent.set_expanded(true);treeView.commitChanges();returnfalse;}
<telerik:RadComboBox ID="rcbTest" runat="server" Width="200px" Skin="Web20" AllowCustomText="true" MarkFirstMatch="true" AutoPostBack="true" OnSelectedIndexChanged="rcbTest_OnSelectedIndexChanged"> <Items> <telerik:RadComboBoxItem Text="Test1" Value="1" /> <telerik:RadComboBoxItem Text="Test2" Value="2" /> <telerik:RadComboBoxItem Text="Test3" Value="3" /> <telerik:RadComboBoxItem Text="Test4" Value="4" /> <telerik:RadComboBoxItem Text="Test5" Value="5" /> </Items> </telerik:RadComboBox> <asp:Button ID="btnGo" runat="server" Text=" Go " Width="75px" OnClick="btnGo_Click"/>Please tell me how can i acheive this scenario.
Thank You
Shaik Nazeer Hussain