I have page set up with a radsplitter and three panes. This is to edit packages. There is a package_id as the key to the packages table.
There is a left vertical pane that has a grid with one column. I have a pane on the right that has a grid. When the user selects a row on the left pane, I have client code to get the package_id, puts that number in a textbox, and then the grid on the right uses the textbox as a parameter to a select command to get data from tables to populate the grid on the right which will have package info.
Once the user clicks on the selected row, I have the client javascript put the package_id in the textbox and then call server code using ajaxrequest to rebind the grid with the proper package info. In my debugger, the textbox has the current selected package_id, but the grid does not rebind. What I am doing wrong? Here is my code:
There is a left vertical pane that has a grid with one column. I have a pane on the right that has a grid. When the user selects a row on the left pane, I have client code to get the package_id, puts that number in a textbox, and then the grid on the right uses the textbox as a parameter to a select command to get data from tables to populate the grid on the right which will have package info.
Once the user clicks on the selected row, I have the client javascript put the package_id in the textbox and then call server code using ajaxrequest to rebind the grid with the proper package info. In my debugger, the textbox has the current selected package_id, but the grid does not rebind. What I am doing wrong? Here is my code:
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head runat="server"> |
<title>Packages</title> |
<style type="text/css"> |
html, body, form |
{ |
height: 100%; |
margin: 0px; |
padding: 0px; |
} |
</style> |
</head> |
<body> |
<form id="form1" runat="server"> |
<div> |
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
</telerik:RadScriptManager> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" |
onajaxrequest="RadAjaxManager1_AjaxRequest" |
DefaultLoadingPanelID="RadAjaxLoadingPanel1"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="packageID"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="buildPackageGrid" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="mainSplitter"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="mainSplitter" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="10"> |
<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' |
style="border: 0px;" /> |
</telerik:RadAjaxLoadingPanel> |
<telerik:RadSplitter ID= "mainSplitter" runat="server" Orientation="Vertical" ResizeMode="AdjacentPane" width="100%" |
VisibleDuringInit="false" Height="100%" ResizeWithParentPane="true"> |
<telerik:RadPane id="leftPane" runat="server" width="22" minwidth="22" Scrolling="none"> |
<telerik:RadSlidingZone id="SlidingZone1" runat="server" clicktoopen="true" DockedPaneId="sPackages" ExpandedPaneId="sPackages" > |
<telerik:RadSlidingPane id="sPackages" title="Packages" runat="server" width="215" Scrolling="Both" EnableResize="false" > |
<telerik:RadGrid ID="packageGrid" runat="server" Width="200px" |
DataSourceID="SqlDataSourcePackages" AutoGenerateColumns="False" |
GridLines="None" > |
<ClientSettings> |
<Selecting AllowRowSelect="true" EnableDragToSelectRows="true" /> |
<ClientEvents OnRowSelected="rowSelected" /> |
</ClientSettings> |
<MasterTableView> |
<Columns> |
<telerik:GridBoundColumn DataField="package_id" UniqueName="package_id" Display="false"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="package_name" UniqueName="package_name" HeaderText="Package name" > |
</telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
<FilterMenu EnableTheming="True"> |
<CollapseAnimation Duration="200" Type="OutQuint" /> |
</FilterMenu> |
</telerik:RadGrid> |
</telerik:RadSlidingPane> |
</telerik:RadSlidingZone> |
</telerik:RadPane> |
<telerik:RadSplitBar id="Radsplitbar3" runat="server" collapsemode="Forward" /> |
<telerik:RadPane id="contentPane" runat="server" Scrolling="Both" > |
<telerik:RadSplitter ID= "embeddedSplitter" runat="server" Orientation="Horizontal" ResizeMode="EndPane" width="100%" |
VisibleDuringInit="false" Height="100%" ResizeWithParentPane="true"> |
<telerik:RadPane ID="topPane" runat="server" ContentUrl="contentviewer.aspx?price=Y"> |
</telerik:RadPane> |
<telerik:RadSplitBar id="Radsplitbar2" runat="server" collapsemode="Both" /> |
<telerik:RadPane ID="bottomPane" runat="server" > |
<telerik:RadGrid ID="buildPackageGrid" runat="server" DataSourceID="SqlDataSourceselectPackage" > |
<MasterTableView runat="server" AutoGenerateColumns="False"> |
<GroupByExpressions> |
<telerik:GridGroupByExpression> |
<GroupByFields> |
<telerik:GridGroupByField FieldName="mid_type_name" SortOrder="Descending"></telerik:GridGroupByField> |
</GroupByFields> |
<SelectFields> |
<telerik:GridGroupByField FieldAlias="mid_type_name" FieldName="mid_type_name" HeaderText="Mid type" /> |
</SelectFields> |
</telerik:GridGroupByExpression> |
</GroupByExpressions> |
<Columns> |
<telerik:GridBoundColumn UniqueName="mid_name" DataField="mid_name" HeaderText="Package Contents" ></telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="package_name" DataField="package_name" HeaderText="Package Name" SortExpression="package_name"></telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="mid_type_name" DataField="mid_type_name" HeaderText="Mid type" SortExpression="mid_type_name"></telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
</telerik:RadGrid> |
</telerik:RadPane> |
</telerik:RadSplitter> |
</telerik:RadPane> |
</telerik:RadSplitter> |
<asp:TextBox ID="packageID" runat="server" Visible="true" Width="0" Height="0" |
style="border: 0px solid #b0c4de;background-color:#b0c4de;"></asp:TextBox> |
<asp:SqlDataSource ID="SqlDataSourcePackages" runat="server" |
ConnectionString="<%$ ConnectionStrings:CC2ConnectionString2 %>" |
SelectCommand="SELECT [package_id], [package_name], [package_cd], [mid_id] FROM [PACKAGES]"></asp:SqlDataSource> |
<asp:SqlDataSource ID="SqlDataSourceselectPackage" runat="server" |
ConnectionString="<%$ ConnectionStrings:CC2ConnectionString2 %>" |
SelectCommand="SELECT DISTINCT PACKAGES.package_id, PACKAGES.package_name, PACKAGES.descriptions, MODULE_IDS.mid_id, MODULE_IDS.mid_type_id, MODULE_IDS.mid_name, PACKAGES.package_cd, PACKAGES.pkg_type, MID_TYPES.mid_type_name FROM MID_TYPES INNER JOIN MODULE_IDS ON MID_TYPES.mid_type_id = MODULE_IDS.mid_type_id INNER JOIN PACKAGE_MIDS ON MODULE_IDS.mid_id = PACKAGE_MIDS.mid_id INNER JOIN PACKAGES ON PACKAGE_MIDS.package_id = PACKAGES.package_id WHERE (PACKAGES.package_id = @packageID)"> |
<SelectParameters> |
<asp:ControlParameter ControlID="packageID" Name="packageID" |
PropertyName="Text" DefaultValue="501" /> |
</SelectParameters> |
</asp:SqlDataSource> |
namespace ContentCentral |
{ |
public partial class Packages : System.Web.UI.Page |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
} |
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) |
{ |
string sPackageID = packageID.Text; |
buildPackageGrid.Rebind(); |
} |
} |
} |