Hi,
I am working on a form that requires a detail grid view for each Grid object. I have made a main OrderView Grid which just shows the dates for the orders and a child grid that should get the OrderDate from the Parent grid and show orders just for the selected Date in the parent grid. the OrderDate is common between both grids, but when I try to pass in the OrderDate to the child grid as a select param for the Object data source it always comes out something like '1/1'0001' and does not pass in the correct date from the parent grid. I am attaching my sample project as a file along with, I looked at the example at http://demos.telerik.com/aspnet-ajax/grid/examples/programming/detailtabledatabind/defaultcs.aspx
to do this. Can someone please show me how to do this with an example in code? Your helps appreciated thanks.
ASPX PAGE: <telerik:RadGrid runat="server" ID="grdOrderDates" Width="750px" Height="100%" AllowPaging="true" AllowSorting="true" EnableLinqExpressions="false" ShowFooter="true" ondetailtabledatabind="grdOrderDates_DetailTableDataBind"> <PagerStyle Mode="NextPrevAndNumeric" /> <MasterTableView AutoGenerateColumns="false" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" InsertItemPageIndexAction="ShowItemOnCurrentPage" DataKeyNames="OrderDate" CommandItemDisplay="Top" EditMode="PopUp" AllowMultiColumnSorting="true" OverrideDataSourceControlSorting="true" AllowFilteringByColumn="true" FilterItemStyle-HorizontalAlign="Left" ShowFooter="true" ShowHeader="true" HierarchyLoadMode="ServerOnDemand"> <CommandItemSettings AddNewRecordText="" /> <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"> </RowIndicatorColumn> <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"> </ExpandCollapseColumn> <DetailTables> <telerik:GridTableView AutoGenerateColumns="false" DataKeyNames="OrderDate" DataSourceID="ODSOrders"> <ParentTableRelation> <telerik:GridRelationFields DetailKeyField="Date" MasterKeyField="OrderDate" /> </ParentTableRelation> <Columns> <telerik:GridBoundColumn DataField="Date" HeaderText="OrderDate" ></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="OrderID" HeaderText="OrderID" ></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Customer" HeaderText="Customer" ></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Location" HeaderText="Location" ></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Destination" HeaderText="Destination" ></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Quantity" HeaderText="Quantity" ></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="QuantityRemaining" HeaderText="Quantity Remaining" ></telerik:GridBoundColumn> </Columns> </telerik:GridTableView> </DetailTables> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"> <HeaderStyle></HeaderStyle> </telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="OrderDate" UniqueName="OrderDate" HeaderText="Order Date" /> </Columns> </MasterTableView> <GroupingSettings CaseSensitive="False" /> </telerik:RadGrid> </div> <asp:ObjectDataSource ID="ODSOrderList" runat="server" TypeName="DAL.OrderRepository" DataObjectTypeName="DAL.OrderView" SelectMethod="getOrderDatesinRange" onselecting="ODSOrderList_Selecting"> <SelectParameters> <asp:Parameter Name="StartDate" DbType="DateTime" /> <asp:Parameter Name="EndDate" DbType="DateTime" /> </SelectParameters> </asp:ObjectDataSource> <asp:ObjectDataSource ID="ODSOrders" runat="server" TypeName="DAL.OrderRepository" DataObjectTypeName="DAL.Order" SelectMethod="getOrderListinRange" > <SelectParameters> <asp:SessionParameter Name="orderDate" SessionField="OrderDate" DbType="DateTime" /> </SelectParameters> </asp:ObjectDataSource> </asp:Content> C# Code : protected void Page_Load(object sender, EventArgs e) { } public void LoadOrdersByDate() { //Loads Parent Grid when date range for Orders is given and binds Parent grid grdOrderDates.DataSourceID = "ODSOrderList"; grdOrderDates.DataBind(); } protected void ODSOrderList_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["StartDate"] = CalStartDate.SelectedDate; e.InputParameters["EndDate"] = CalEndDate.SelectedDate; } protected void BtnSubmit_Click(object sender, EventArgs e) { //Loads Parent Grid when date range for Orders is given and binds Parent grid LoadOrdersByDate(); } protected void grdOrderDates_DetailTableDataBind(object sender, Telerik.Web.UI.GridDetailTableDataBindEventArgs e) { try { GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem; DateTime orderDate = Convert.ToDateTime(dataItem.GetDataKeyValue("OrderDate")); e.DetailTableView.DataSourceID = "ODSOrders"; //Pass in the OrderDate value from the Parent grid so the child grid only shows Orders for the selected Date ODSOrders.SelectParameters["orderDate"].DefaultValue = orderDate.ToString(); e.DetailTableView.DataBind(); } catch (Exception ex) { throw ex; } }
DataTable data = new DataTable();
data.Columns.Add(
"ParentID");
data.Columns.Add(
"ChildID");
data.Columns.Add(
"Text");
data.Rows.Add(
null, "1", "Market 1");
data.Rows.Add(
null, "2", "Market 2");
data.Rows.Add(
"1", "1", "1_Client");
data.Rows.Add(
"1", "2", "2_Client");
data.Rows.Add(
"2", "1", "1_Client");
data.Rows.Add(
"2", "4", "4_Client");
data.Rows.Add(
"2", "5", "5_Client");
radTreeClientMarket.DataFieldID =
"ChildID";
radTreeClientMarket.DataFieldParentID =
"ParentID";
radTreeClientMarket.DataTextField =
"Text";
radTreeClientMarket.DataSource = data;
radTreeClientMarket.DataBind();
here , child "1_client" is having two parents and my tree view also should be in the way around.
Please reply me as soon as possible as all stopped in this.
Thanks,
Priya
hello,
i am working on email functionality and recently i am using rad uploader to upload files and send to mails through smtp connection.the code that i wrote working fine in localsystem,but when we deploy it on IIS(V 5.1 or 7) it is getting error,path cannot be found /access to path is denied ,i am sending code block please reply soon ,Thanks.
System.Net.Mail.Attachment attachment; foreach (UploadedFile file in RadUpload1.UploadedFiles) { try { string strFileName = null; strFileName = System.IO.Path.GetFullPath(file.FileName); attachment = new System.Net.Mail.Attachment(strFileName); Message.Attachments.Add(attachment); } catch { } }
<telerik:RadWindowManager ID="rdWindowManager" runat="server" EnableEmbeddedSkins="false" Skin="rdWindowsAlert"> </telerik:RadWindowManager> <telerik:RadAjaxManager ID="rdAjaxmanager" runat="server"> <AjaxSettings> <telerik:AjaxSetting> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="rdWindowManager" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager>* Window Background */ /* Horiznotal */.RadWindow_rdWindowsAlert .rwTopLeft, .RadWindow_rdWindowsAlert .rwTopRight, .RadWindow_rdWindowsAlert .rwTitlebar, .RadWindow_rdWindowsAlert .rwFooterLeft, .RadWindow_rdWindowsAlert .rwFooterRight, .RadWindow_rdWindowsAlert .rwFooterCenter, .RadWindow_rdWindowsAlert .rwTopResize, .RadWindow_rdWindowsAlert .rwStatusbar div, .RadWindow_rdWindowsAlert .rwStatusbar, .RadWindow_rdWindowsAlert .rwPopupButton, .RadWindow_rdWindowsAlert .rwPopupButton span, .RadWindow_rdWindowsAlert.rwMinimizedWindow .rwCorner { background-image: url('Window/WindowHorizontalSprites.gif'); } /* Vertical */.RadWindow_rdWindowsAlert .rwBodyLeft, .RadWindow_rdWindowsAlert .rwBodyRight, .RadWindow_rdWindowsAlert .rwStatusbarRow .rwCorner { background-image: url('Window/WindowVerticalSprites.gif'); } /* Window Shadows */ /* Horiznotal */.RadWindow_rdWindowsAlert .rwShadow .rwTopLeft, .RadWindow_rdWindowsAlert .rwShadow .rwTopRight, .RadWindow_rdWindowsAlert .rwShadow .rwTitlebar, .RadWindow_rdWindowsAlert .rwShadow .rwFooterLeft, .RadWindow_rdWindowsAlert .rwShadow .rwFooterRight, .RadWindow_rdWindowsAlert .rwShadow .rwFooterCenter, .RadWindow_rdWindowsAlert .rwShadow .rwTopResize, .RadWindow_rdWindowsAlert .rwShadow .rwStatusbar div, .RadWindow_rdWindowsAlert .rwShadow .rwStatusbar, .RadWindow_rdWindowsAlert .rwShadow .rwPopupButton, .RadWindow_rdWindowsAlert .rwShadow .rwPopupButton span, .RadWindow_rdWindowsAlert .rwShadow .rwBodyLeft, .RadWindow_rdWindowsAlert .rwShadow .rwBodyRight, .RadWindow_rdWindowsAlert .rwShadow .rwStatusbarRow .rwBodyLeft, .RadWindow_rdWindowsAlert .rwShadow .rwStatusbarRow .rwBodyRight { background-image: url('Window/WindowHorizontalSprites.png'); } /* Vertical */.RadWindow_rdWindowsAlert .rwShadow .rwBodyLeft, .RadWindow_rdWindowsAlert .rwShadow .rwBodyRight, .RadWindow_rdWindowsAlert .rwShadow .rwStatusbarRow .rwBodyLeft, .RadWindow_rdWindowsAlert .rwShadow .rwStatusbarRow .rwBodyRight { background-image: url('Window/WindowVerticalSprites.png'); } /* Shadows End */ .RadWindow_rdWindowsAlert .rwControlButtons a { background-image: url('Window/CommandButtonSprites.gif'); } .RadWindow_rdWindowsAlert a.rwIcon { background-image: url('Window/WindowHorizontalSprites.gif'); } div.RadWindow_rdWindowsAlert .rwTitlebarControls em { color:#28638f; /* Model title Color */ background-image:none !important; } div.RadWindow_rdWindowsAlert .rwDialogInput { border-top: solid 1px #afb1b2; border-right: solid 1px #e1e4e6; border-bottom: solid 1px #ebeef0; border-left: solid 1px #e8eaeb; } div.RadWindow_rdWindowsAlert .rwDialogInput:hover { border-top: solid 1px #86a6bf; border-right: solid 1px #cedeeb; border-bottom: solid 1px #dce9f2; border-left: solid 1px #d8e4ed; } .RadWindow_rdWindowsAlert td.rwWindowContent { margin-left: 15px !important; /* background-color: #dcdcdc; */} .RadWindow_rdWindowsAlert .rwWindowContent .radalert { background-image:none !important; } div.RadWindow_rdWindowsAlert a.rwCancel, div.RadWindow_rdWindowsAlert a.rwCancel span { background: none; cursor: pointer; } div.RadWindow_rdWindowsAlert a.rwCancel span span { color: #000000; text-decoration: underline; } /* Shadow Control Buttons */ .RadWindow_rdWindowsAlert .rwShadow .rwControlButtons { margin: 5px -2px 0 0; } .RadWindow_rdWindowsAlert .rwShadow .rwControlButtons { margin: 5px -1px 0 0\9; } .RadWindow_rdWindowsAlert .rwShadow .rwControlButtons li { float: left; padding: 0; } div.RadWindow_rdWindowsAlert .rwControlButtons a { width: 26px; } <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <telerik:RadComboBox ID="testRadCombo1" runat="server" Filter="Contains" AutoPostBack="True"> <Items> <telerik:RadComboBoxItem Text="AAA" Value="1" /> <telerik:RadComboBoxItem Text="AAB" Value="2" /> <telerik:RadComboBoxItem Text="AAC" Value="3" /> <telerik:RadComboBoxItem Text="BBB" Value="4" /> <telerik:RadComboBoxItem Text="BBA" Value="5" /> <telerik:RadComboBoxItem Text="BBC" Value="6" /> <telerik:RadComboBoxItem Text="CCC" Value="7" /> <telerik:RadComboBoxItem Text="CCA" Value="8" /> <telerik:RadComboBoxItem Text="CCB" Value="9" /> </Items> </telerik:RadComboBox> </div> </form> </body></html><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />function nodeClicking(sender, eventArgs) { var comboBox = $find("<%= radComboBoxUnits.ClientID %>"); var node = eventArgs.get_node() node.set_selected(true); comboBox.set_text(node.get_text()); comboBox.hideDropDown();}<Scrolling AllowScroll="true" ScrollHeight="400" SaveScrollPosition="true" UseStaticHeaders="true"
FrozenColumnsCount="2" />
<table border="0" align="center" cellpadding="0" cellspacing="0" style="table-layout: fixed;">
so, now my telerik grid is getting flickering when scrolling and loading.
Plese provide me the solution for this.