I have requirement for hierarchal data grid. I'm binding the grid's datasource with a collection.
Each of the item within that collection has another collection as a Property.
Is there a way to bind the grid in such a way that , it automatically takes the inner collection as datasource for DetailsTable,
whereas the outercollection as datasource for MasterTableView ?
The telerik eg., i have seen, have datasource provided exclusively for both MasterTableview as well as Detailtable and the relation between them specifed using ParentTableRelation.
In my case, i have the relation between master & detail maintained in my collection. So binding the grid in NeedDatasource event and specifying the DataMember property declaritively should work.
let me know if you think i'm missing something ,
I donot wish to maintain two different datasource , as i have lot of grid operations.
I'm using a hierarchical grid. My Radgrid contain NestedViewTemplate which contain Another Radgrid .Inner Radgrid contain some GridBoundColumn and GridButtonColumn called EDIT.This Inner Grid use <EditFormSettings EditFormType="Template">.
Now when we click on Edit,it is not able to open Edit form template.Instead of this, All the rows inside the inner grid get disappear.
Please help me out here...Thanks in advance.
<telerik:RadGrid ID="Radgrid1" Visible="true" runat="server" EnableViewState="true" AllowPaging="false" AllowSorting="true" AutoGenerateColumns="false" Skin="Vista" OnItemCommand="Radgrid1_ItemCommand" OnSortCommand="Radgrid1_SortCommand" AllowAutomaticDeletes="true" AllowAutomaticInserts="false" AllowAutomaticUpdates="false"> <MasterTableView Width="100%" Name="mastertableview" DataKeyNames="custemerid" > <NestedViewTemplate> <telerik:RadGrid ID="Radgrid2" AllowAutomaticDeletes="true"" AllowAutomaticInserts="false" AllowAutomaticUpdates="true" AllowSorting="true" OnItemCommand="Radgrid2_ItemCommand"> <MasterTableView CommandItemDisplay="Top" DataKeyNames="orderID" AutoGenerateColumns="false" EditMode="EditForms" InsertItemDisplay="Top"> <Columns> <telerik:GridBoundColumn HeaderText="" </telerik:GridBoundColumn> <telerik:GridTemplateColumn HeaderText="Order Name" UniqueName="Order Name" <ItemTemplate> <asp:Label runat="server" ID="lblOrderName" Text='<%# AntiXss.HtmlEncode(Eval("OrederName").ToString())%>'></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="" </telerik:GridTemplateColumn> <telerik:GridButtonColumn HeaderText="Edit" CommandName="Edit" Text="Edit" ItemStyle-HorizontalAlign="Center" ButtonType="ImageButton" UniqueName="EditCommandColumn" ImageUrl="~/OneViewImages/edit.png"> </telerik:GridButtonColumn> <telerik:GridButtonColumn HeaderText="Delete" ButtonType="ImageButton" ConfirmText="Are you sure you want to delete this User?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" CommandName="Delete" Text="Delete User" UniqueName="DeleteColumn" > </telerik:GridButtonColumn> </Columns> <CommandItemSettings AddNewRecordText="Add New User" /> <EditFormSettings EditFormType="Template"> <FormStyle Font-Size="11px" /> <FormTemplate> Edit form is here Along with two Image button as Save and Calcel mention below <asp:ImageButton ID="btnUpdate" runat="server" ToolTip="Save" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' /> <asp:ImageButton ID="btnCancel" runat="server" ToolTip="cancel" CausesValidation="False" CommandName="Cancel" /> </FormTemplate> </EditFormSettings> </MasterTableView> <ValidationSettings CommandsToValidate="PerformInsert,Update" ValidationGroup="ValidationGrp1" /> </telerik:RadGrid> </NestedViewTemplate> <Columns> <telerik:GridBoundColumn UniqueName="CustomerID" DataField="CustomerId" Visible="false" ReadOnly="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CustomerName" UniqueName="CustomerName" > </telerik:GridBoundColumn> </Columns> <ExpandCollapseColumn Visible="True"> </ExpandCollapseColumn> </MasterTableView> </telerik:RadGrid> Code Behind: protected void Radgrid1_ItemCommand(object source, GridCommandEventArgs e) { RadGrid grid = (source as RadGrid); if ((e.CommandName == RadGrid.InitInsertCommandName || e.CommandName == RadGrid.EditCommandName || e.CommandName == RadGrid.EditAllCommandName || e.CommandName == RadGrid.EditSelectedCommandName) && insertMode ) { grid.MasterTableView.ClearEditItems(); e.Item.OwnerTableView.IsItemInserted = false; } if ((e.CommandName == "ExpandCollapse") && (!e.Item.Expanded)) { // populate innergrid } } protected void Radgrid2_ItemCommand(object source, GridCommandEventArgs e) { //Code for During Add,Edit can no happen and vice-versa bool editMode = e.Item.OwnerTableView.OwnerGrid.EditIndexes.Count > 0; bool insertMode = e.Item.OwnerTableView.IsItemInserted; RadGrid Radgrid2 = (source as RadGrid); if ((e.CommandName == RadGrid.InitInsertCommandName || e.CommandName == RadGrid.EditCommandName || e.CommandName == RadGrid.EditAllCommandName || e.CommandName == RadGrid.EditSelectedCommandName) && (insertMode || editMode)) { Radgrid2.MasterTableView.ClearEditItems(); e.Item.OwnerTableView.IsItemInserted = false; } if (e.CommandName == "Delete") {if (e.Item is GridDataItem) { //Delete the selected OrderId then bind the inner grid using Radgrid2.Rebind(); } if (e.CommandName == "Edit") { Radgrid2.MasterTableView.EditFormSettings.UserControlName = null; Radgrid2.MasterTableView.EditFormSettings.EditFormType = GridEditFormType.Template; if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; //Some field to be loaded in edit mode } Radgrid2.Rebind(); } if (e.CommandName == "Cancel") { Radgrid2.Rebind(); BindGrid(); // use to bind Outer grid } if (e.CommandName == "Update") { //some code } if (e.CommandName == "InitInsert") { //Some code Radgrid2.MasterTableView.ClearEditItems(); Radgrid2.MasterTableView.IsItemInserted = true; Radgrid2.Rebind(); Radgrid1.Rebind(); } } if (e.CommandName == "PerformInsert") { //some code } } | <telerik:RadTextBox ID="txtComment" runat="server" |
| ValidationGroup="CommentValidation" CausesValidation="True" MaxLength="4096" |
| Skin="Black" Width="450px" TextMode="MultiLine" Height="150px" AcceptReturn="True" /> |
I'm migrating repeater control in my code to telerik grid control.
In my repeater control i'm using the following piece of code as my URL
<
a href="<%# Globals.GetSiteUrls().Post( (int) DataBinder.Eval(Container.DataItem, "PostID") ) %> ">
I have to use the same in GridHyperLinkColumn.
How to give value in DataNavigateUrlFormatString??
<
script type="text/javascript">
function RowClick(sender, eventArgs) {
alert("Click on row instance: " + eventArgs.get_itemIndexHierarchical());
sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
}
</script>
How can I stop the click on the parent and actually have it not generate and start the in-line edit on the client?
<script type="text/javascript"> var doPostback = true; function pageLoad() { doPostback = false; $find("<%= RadComboBox1.ClientID %>").findItemByValue("YourItemHere").select(); doPostback = true; } function OnClientSelectedIndexChanged(sender, eventArgs) { if (doPostback) { __doPostBack('RadComboBox1', ''); } } </script><telerik:RadAjaxManagerProxy ID="AjaxManagerProxy1" runat="server"><AjaxSettings> <telerik:AjaxSetting AjaxControlID="grdOne" > <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="txtOne" LoadingPanelID="RadAjaxLoadingPanel3" /> <telerik:AjaxUpdatedControl ControlID="pnlOne" LoadingPanelID="RadAjaxLoadingPanel3" /> </UpdatedControls> </telerik:AjaxSetting>
Partial Public Class Plans Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Master.pgmCurrentMenu = "Plans" Master.InitBanner() End Sub Private Sub RadFileExplorer1_ExplorerPopulated(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadFileExplorerPopulatedEventArgs) Handles RadFileExplorer1.ExplorerPopulated Dim result As List(Of FileBrowserItem) = New List(Of FileBrowserItem) For Each item In e.List If item.Name.ToUpper.Contains(TextBox1.Text.ToUpper) Then result.Add(item) End If Next e.List = result End Sub Private Sub RadFileExplorer1_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadFileExplorerEventArgs) Handles RadFileExplorer1.ItemCommand Dim Utilisateur As String Dim Fichier As New Gestion_FichierUpload Utilisateur = Master.pgmInfoUser.Login Master.pgmCurrentMenu = "BEPLAN" Master.InitBanner() 'MsgBox(e.Command.ToString) 'MsgBox(e.NewPath.ToString) 'MsgBox(e.Path.ToString) Select Case e.Command Case "UploadFile" If (e.Path = e.NewPath) Then Fichier.Add_Fichier_Sql(e.Path.ToString, Utilisateur, "Ecraser") Else Fichier.Add_Fichier_Sql(e.Path.ToString, Utilisateur, "Telecharger") End If Case "MoveDirectory" Fichier.Renommer_Dossier(e.Path, e.NewPath, Utilisateur) Case "CreateDirectory" Fichier.Add_Repertoire_Sql(e.Path.ToString & e.NewPath.ToString, Utilisateur) Case "DeleteFile" Fichier.Copie_Corbeille(e.Path, e.NewPath) Fichier.Supp_Fichier_Sql(e.Path, Utilisateur) Case "MoveFile" Fichier.Renommer_Fichier(e.Path, e.NewPath, Utilisateur) Case "DeleteDirectory" Fichier.Supp_Repertoire_Sql(e.Path.ToString, Utilisateur) Case Else End Select Dim viewPaths As String() = New String() {""} Dim test As New Gestion_FichierUpload If RadFileExplorer1.CurrentFolder <> "Donnees BE/" & RadComboBox1.SelectedValue.ToString And RadFileExplorer1.CurrentFolder IsNot Nothing Then Dim s1 As String = "" s1 = RadFileExplorer1.CurrentFolder viewPaths = New String() {RadFileExplorer1.CurrentFolder} RadFileExplorer1.Visible = True RadFileExplorer1.TreeView.Nodes.Clear() RadFileExplorer1.Configuration.ViewPaths = viewPaths RadFileExplorer1.Configuration.UploadPaths = viewPaths RadFileExplorer1.Configuration.DeletePaths = viewPaths RadFileExplorer1.TreeView.MaxDataBindDepth = 30 RadFileExplorer1.DisplayUpFolderItem = True RadFileExplorer1.EnableCopy = True RadFileExplorer1.EnableCreateNewFolder = True RadFileExplorer1.Language = "fr-FR" RadFileExplorer1.Configuration.MaxUploadFileSize = 100000000 RadFileExplorer1.AllowPaging = True RadFileExplorer1.Visible = True RadFileExplorer1.InitialPath = s1 RadFileExplorer1.Configuration.ContentProviderTypeName = GetType(CustomFileSystemProvider).AssemblyQualifiedName End If If RadComboBox1.SelectedValue <> Session.Item("ComboValue") Then Dim s1 As String = "" s1 = RadFileExplorer1.CurrentFolder Session.Clear() Session.Add("ComboValue", RadComboBox1.SelectedValue) viewPaths = New String() {test.Get_Repertoire(RadComboBox1.SelectedValue.ToString)} RadFileExplorer1.Visible = True RadFileExplorer1.TreeView.Nodes.Clear() RadFileExplorer1.Configuration.ViewPaths = viewPaths RadFileExplorer1.Configuration.UploadPaths = viewPaths RadFileExplorer1.Configuration.DeletePaths = viewPaths RadFileExplorer1.TreeView.MaxDataBindDepth = 30 RadFileExplorer1.DisplayUpFolderItem = True RadFileExplorer1.EnableCopy = True RadFileExplorer1.Language = "fr-FR" RadFileExplorer1.Configuration.MaxUploadFileSize = 100000000 RadFileExplorer1.AllowPaging = True RadFileExplorer1.EnableCreateNewFolder = True RadFileExplorer1.InitialPath = s1 RadFileExplorer1.Configuration.ContentProviderTypeName = GetType(CustomFileSystemProvider).AssemblyQualifiedName End If End Sub Private Sub RadFileExplorer1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadFileExplorer1.Load Dim viewPaths As String() = New String() {""} Dim test As New Gestion_FichierUpload Dim Utilisateur As String = Master.pgmInfoUser.Autorisation If IsPostBack Then If RadFileExplorer1.CurrentFolder <> "Donnees BE/" & RadComboBox1.SelectedValue.ToString And RadFileExplorer1.CurrentFolder IsNot Nothing Then Dim s1 As String = "" s1 = RadFileExplorer1.CurrentFolder viewPaths = New String() {RadFileExplorer1.CurrentFolder} RadFileExplorer1.Visible = True RadFileExplorer1.TreeView.Nodes.Clear() RadFileExplorer1.Configuration.ViewPaths = viewPaths RadFileExplorer1.Configuration.UploadPaths = viewPaths RadFileExplorer1.Configuration.DeletePaths = viewPaths RadFileExplorer1.TreeView.MaxDataBindDepth = 30 RadFileExplorer1.DisplayUpFolderItem = True RadFileExplorer1.EnableCopy = True RadFileExplorer1.EnableCreateNewFolder = True RadFileExplorer1.Language = "fr-FR" RadFileExplorer1.Configuration.MaxUploadFileSize = 100000000 RadFileExplorer1.AllowPaging = True RadFileExplorer1.Visible = True RadFileExplorer1.InitialPath = s1 RadFileExplorer1.Configuration.ContentProviderTypeName = GetType(CustomFileSystemProvider).AssemblyQualifiedName End If If RadComboBox1.SelectedValue <> Session.Item("ComboValue") Then Dim s1 As String = "" s1 = RadFileExplorer1.CurrentFolder Session.Clear() Session.Add("ComboValue", RadComboBox1.SelectedValue) viewPaths = New String() {test.Get_Repertoire(RadComboBox1.SelectedValue.ToString)} RadFileExplorer1.Visible = True RadFileExplorer1.TreeView.Nodes.Clear() RadFileExplorer1.Configuration.ViewPaths = viewPaths RadFileExplorer1.Configuration.UploadPaths = viewPaths RadFileExplorer1.Configuration.DeletePaths = viewPaths RadFileExplorer1.TreeView.MaxDataBindDepth = 30 RadFileExplorer1.DisplayUpFolderItem = True RadFileExplorer1.EnableCopy = True RadFileExplorer1.Language = "fr-FR" RadFileExplorer1.Configuration.MaxUploadFileSize = 100000000 RadFileExplorer1.AllowPaging = True RadFileExplorer1.EnableCreateNewFolder = True RadFileExplorer1.InitialPath = s1 RadFileExplorer1.Configuration.ContentProviderTypeName = GetType(CustomFileSystemProvider).AssemblyQualifiedName End If Else viewPaths = New String() {"Donnees BE/140"} RadFileExplorer1.TreeView.Nodes.Clear() RadFileExplorer1.Configuration.ViewPaths = viewPaths RadFileExplorer1.Configuration.UploadPaths = viewPaths RadFileExplorer1.Configuration.DeletePaths = viewPaths RadFileExplorer1.TreeView.MaxDataBindDepth = 30 RadFileExplorer1.DisplayUpFolderItem = True RadFileExplorer1.EnableCopy = True RadFileExplorer1.EnableCreateNewFolder = True RadFileExplorer1.Language = "fr-FR" RadFileExplorer1.Configuration.MaxUploadFileSize = 100000000 RadFileExplorer1.AllowPaging = True RadFileExplorer1.Visible = False RadFileExplorer1.Configuration.ContentProviderTypeName = GetType(CustomFileSystemProvider).AssemblyQualifiedName End If End Sub Private Sub TextBox1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Load TextBox1.AutoPostBack = True End Sub Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged TextBox1.AutoPostBack = True End Sub Private Sub RadComboBox1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadComboBox1.Load RecursiveSearch2("\\vm-cham-files2\Share$\Plans\PLANS BE\", RadComboBox1) End Sub Private Function RecursiveSearch2(ByVal path As String, ByVal Radcombobox As RadComboBox) As List(Of String) Dim repertoires As New List(Of String) Dim dirInfo As New IO.DirectoryInfo(path) Dim fileObject As FileSystemInfo Dim compteur As Integer = 0 compteur = dirInfo.GetFileSystemInfos().Length For Each fileObject In dirInfo.GetFileSystemInfos() Dim rdcbbox As New RadComboBoxItem rdcbbox.Value = fileObject.Name rdcbbox.Text = fileObject.Name Radcombobox.Items.Add(rdcbbox) Next Return repertoires End FunctionEnd Class
My main problem occurs when I try to upload or create new folder on nodes deeper than 2
Example:
Folder1 Buttons (Upload and CreateNewFolder) enabled
-Folder2 Buttons (Upload and CreateNewFolder) enabled
-Folder3 Buttons (Upload and CreateNewFolder) enabled
-Folder4 Buttons (Upload and CreateNewFolder) disabled
-Folder5 Buttons (Upload and CreateNewFolder) disabled
Thanx for your help