or
Hi,
I am trying to integrate a treeview and grid by dragging nodes to the grid to create records. I have code working where I can drag a treenode to a grid and fire the code behind to insert a new record etc...
| Protected Sub ApplicationsTreeView_OnNodeDrop(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeDragDropEventArgs) Handles ApplicationsTreeView.NodeDrop |
| If e.HtmlElementID = (ProjectApplicationsGrid.ClientID & "_GridData") Then |
| Dim InsertRecordDataSource As SqlDataSource = ProjectApplicationsDataSource |
| Dim Project_ID As Integer = CInt(Request.QueryString("Project_ID")) |
| Dim Application_ID As Integer = CInt(e.SourceDragNode.Value) |
| InsertRecordDataSource.InsertParameters("Project_ID").DefaultValue = Project_ID |
| InsertRecordDataSource.InsertParameters("Application_ID").DefaultValue = Application_ID |
| ProjectApplicationsDataSource.Insert() |
| ProjectApplicationsGrid.Rebind() |
| End If |
| function ApplicationsTreeView_ClientNodeDropping(sender, args) { |
| var dest = args.get_destNode(); |
| alert(dest); |
| if (dest==null) { args.set_cancel(false); return; } else { args.set_cancel(true); return; } ; |
| } |

| var _71e; |
| if(this.get_enableXhtmlFilter()){ |
| try{ |
| _71e=this._convertToXhtmlFilter.getHtmlContent(_71b); |
| } |
| catch(exc){ |
| alert("Error while executing filter XHTML - "+exc.toString()); |
| } |
| }else{ |
| _71e=$telerik.getOuterHtml(_71b); |
| } |
| _71e=_71e.replace(/<body\s*\/>/i,"<body></body>"); |
| for(var i=0;i<this._filters.length;i++){ |
| var _71d=this._filters[i]; |
| if((!_71d.get_isDom())&&(false!=_71d.get_enabled())&&_71d.getHtmlContent){ |
| try{ |
| _71e=_71d.getHtmlContent(_71e); |
| } |
| <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="radAjaxLoadingPanel"> |
| <telerik:RadGrid ID="radGridMenus" runat="server" AllowPaging="false" CssClass="radgrid" |
| ... |
| <EditFormSettings EditFormType="Template"> |
| <FormTemplate> |
| <xs:XHTMLEditor ID="xhtmlEditorPreamble" runat="server" OnLoad="Editor_Load" /> |
| ... |
| protected void radGridMenus_UpdateCommand(object source, GridCommandEventArgs e) |
| { |
| GridEditFormItem gridItem = e.Item as GridEditFormItem; |
| ... |
| content.Preamble = ((XStandard.WebForms.XHTMLEditor)gridItem.FindControl("xhtmlEditorPreamble")).Value.Trim(); ... |
| } |
| <telerik:RadGrid ID="MyRadGrid" runat="server" AllowPaging="True" AllowMultiRowSelection="true" | |
| AutoGenerateColumns="False" AllowAutomaticDeletes="True" AllowMultiRowEdit="true" | |
| AllowAutomaticInserts="False" AllowAutomaticUpdates="False" GridLines="None" | |
| AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="false"> | |
| <ClientSettings Selecting-AllowRowSelect="true"> | |
| </ClientSettings> | |
| <MasterTableView DataKeyNames="MyId" EditMode="EditForms" CommandItemDisplay="Top"> | |
| <RowIndicatorColumn> | |
| <HeaderStyle Width="20px"></HeaderStyle> | |
| </RowIndicatorColumn> | |
| <ExpandCollapseColumn> | |
| <HeaderStyle Width="20px"></HeaderStyle> | |
| </ExpandCollapseColumn> | |
| <Columns> | |
| <telerik:GridDateTimeColumn DataField="date" HeaderText="date" UniqueName="date" | |
| PickerType="DateTimePicker" > | |
| </telerik:GridDateTimeColumn> | |
| </Columns> | |
| </MasterTableView> | |
| <FilterMenu EnableTheming="True"> | |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> | |
| </FilterMenu> | |
| </telerik:RadGrid> |
| void MyRadGrid_ItemCreated(object sender, GridItemEventArgs e) | |
| { | |
| if (e.Item is GridEditableItem && e.Item.IsInEditMode) | |
| { | |
| GridEditableItem item = e.Item as GridEditableItem; | |
| RadDateTimePicker date = item["date"].Controls[0] as RadDateTimePicker; | |
| if (date != null) | |
| date.Calendar.ShowRowHeaders = false; | |
| } |
| <telerik:RadComboBox ID="cmbUnvan" Runat="server" AllowCustomText="True" |
| AutoPostBack="True" EnableLoadOnDemand="True" |
| onitemsrequested="cmbUnvan_ItemsRequested" Height="73px" Width="230px" |
| AutoCompleteSeparator=";" MarkFirstMatch="True"> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| </telerik:RadComboBox> |
| protected void cmbUnvan_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) |
| { |
| RadComboBox combo = (RadComboBox)o; |
| combo.Items.Clear(); |
| SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Personelcon"].ConnectionString; |
| string text = e.Text; |
| string sql = "SELECT * from Unvan WHERE Uname LIKE '" + text.Replace("'", "''") + "%'"; |
| SqlCommand selectCommand = new SqlCommand(sql, connection); |
| SqlDataAdapter adapter = new SqlDataAdapter(selectCommand); |
| DataTable dt = new DataTable(); |
| adapter.Fill(dt); |
| foreach (DataRow row in dt.Rows) |
| { |
| RadComboBoxItem item = new RadComboBoxItem(row["Uname"].ToString()); |
| item.Value = row["Uid"].ToString(); |
| //item.Text = Convert.ToString(row["Uname"]); |
| combo.Items.Add(item); |
| } |
| } |