Currently I can load data into a Grid when a specific value is chosen from a ComboBox. When the page first loads it displays an empty grid though. I am trying to figure out how to have ALL values loaded onto the Grid when the user first visits the page.
This demo provides an example of what I am trying to do but I can't quite get it to work:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridcomboajax/defaultcs.aspx?product=combobox
Here is my current code:
This demo provides an example of what I am trying to do but I can't quite get it to work:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridcomboajax/defaultcs.aspx?product=combobox
Here is my current code:
<%@ Page Title="Report" Language="C#" MasterPageFile="~/MasterPages/Site.Master" AutoEventWireup="true" CodeBehind="Report.aspx.cs" Inherits="Report" Theme="Default" %><asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server"> <table> <tr> <td><label>User: </Label></td> <td> <telerik:RadComboBox ID="EmailRCB" runat="server" AutoPostBack="True" DataSourceID="dllDataSource" DataTextField="email" DataValueField="email" Width="250px" AppendDataBoundItems="true"> <Items> <telerik:RadComboBoxItem Text="- Select User -" Value="0" Selected="true"></telerik:RadComboBoxItem> </Items> </telerik:RadComboBox> </td> </tr> </table><br /> <!-- grid --> <telerik:RadGrid ID="OrdersGrid" AllowPaging="true" DataSourceID="gridSource" runat="server" GridLines="None" AllowSorting="true" ShowFooter="true" PageSize = "1000" Width="1500" > <PagerStyle AlwaysVisible="true" ShowPagerText="true" Position="TopAndBottom" /> <MasterTableView DataSourceID="gridSource" AllowMultiColumnSorting="false"> <NestedViewTemplate> <asp:Panel runat="server" ID="InnerContainer" Visible="true" ViewStateMode="Enabled"> <telerik:RadTabStrip runat="server" ID="tsMain" MultiPageID="mpMain" SelectedIndex="0"> <Tabs> <telerik:RadTab runat="server" Text="Details" PageViewID="pvMain" /> </Tabs> </telerik:RadTabStrip> <telerik:RadMultiPage runat="server" ID="mpMain" SelectedIndex="0" RenderSelectedPageOnly="false"> <telerik:RadPageView runat="server" ID="pvMain"> <asp:Label ID="lblNUM" Font-Bold="true" Font-Italic="true" Text='<%# Eval("NUMBER") %>' Visible="false" runat="server"></asp:Label> <!-- inner/nested grid --> <telerik:RadGrid runat="server" ID="grdOrders" DataSourceID="grdReportDataSource2" ShowFooter="false" AllowSorting="false" Width="700" EnableLinqExpressions="false"> <MasterTableView ShowHeader="true" AutoGenerateColumns="true" AllowPaging="False"> </MasterTableView> </telerik:RadGrid> <!-- datasource for inner/nested grid --> <asp:SqlDataSource ID="grdReportDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:intranetConnectionString %>" SelectCommand="dbo.sp_AuditClientReportNested2" SelectCommandType="StoredProcedure" > <SelectParameters> <asp:ControlParameter ControlID="lblNUM" PropertyName="Text" Type="String" Name="NUM"></asp:ControlParameter> </SelectParameters> </asp:SqlDataSource> </telerik:RadPageView> </telerik:RadMultiPage> </asp:Panel> </NestedViewTemplate> </MasterTableView> <ClientSettings AllowDragToGroup="false"> </ClientSettings> </telerik:RadGrid> </div> <!-- datasource for RadComboBox --> <asp:SqlDataSource ID="dllDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:intranetConnectionString %>" SelectCommand="SELECT DISTINCT EMAIL FROM Table1"></asp:SqlDataSource> <!-- datasource for outer/header grid --> <asp:SqlDataSource ID="gridSource" runat="server" ConnectionString="<%$ ConnectionStrings:intranetConnectionString %>" SelectCommand=" SELECT DISTINCT NUM AS 'Number', EMAIL AS 'Email', BATCHID AS 'Batch ID', NAME AS 'Name', COMPANY AS 'Company', RTRIM(FIRSTNAME) + ' ' + RTRIM(LASTNAME) AS 'Contact Name', DateAdded AS 'Date' FROM Table1 WHERE EMAIL = @email ORDER BY NUM"> <SelectParameters> <asp:ControlParameter Name="email" PropertyName="SelectedValue" ControlID="EmailRCB"> </asp:ControlParameter> </SelectParameters> </asp:SqlDataSource> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="EmailRCB"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="OrdersGrid" LoadingPanelID="AjaxLoadingPanel1"> </telerik:AjaxUpdatedControl> <telerik:AjaxUpdatedControl ControlID="EmailRCB"></telerik:AjaxUpdatedControl> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"> </telerik:RadAjaxLoadingPanel></asp:Content>