Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
89 views
I was wondering if there is a good way to put an image button above a column header for a RadGrid? It needs to be above the header and if the user scrolls the grid, it needs to stay inline with the column. 

Is there an easy way to to do this, or do I have to use some sort of floating panel and javascript when the radgrid scrolls?

I originally solved this by putting a button in the column header using a custom template for the header, but this seems to have broken my export to pdf and export to excel commands for the grid.
Kostadin
Telerik team
 answered on 23 Nov 2012
3 answers
213 views
I am trying to export the contents of my radgrid to a pdf file.  I am using the default skin.  Since I have 13 columns, the data is too long to fit on the page and is cut off.  I was trying to update the size of the text initially and noticed that it was only working on every other row.  I am assuming that this has something to do with the AlternatingItemStyle setting?  Is there something special that I need to add to get this update to work on all rows in the radgrid?  Please let me know if you need for me to provide you with any other information.

protected void listAllAcctsBtnExportToPDF_Click(object sender, EventArgs e)
    {
      ApplyStylesToPDFExport(rgListAllAccounts.MasterTableView);
       rgListAllAccounts.MasterTableView.ExportToPdf();
    }//end of listAllAcctsBtnExportToPDF_Click


private void ApplyStylesToPDFExport(GridTableView view)
    {
      // Get access to the header of the grid 
      GridItem headerItem = view.GetItems(GridItemType.Header)[0];
  
      // Apply some css style to the header 
      headerItem.Cells.Count.ToString();
  
      foreach (TableCell cell in headerItem.Cells)
       
        cell.Style["font-family"] = "Verdana";        
        cell.Style["text-align"] = "left";        
        cell.Style["vertical-align"] = "middle";        
        cell.Style["font-size"] = "10px";
      }
  
      // Get access to the data of the grid 
      GridItem[] dataItems = view.GetItems(GridItemType.Item);      
    
      // Apply some css style to the data items 
      foreach (GridItem item in dataItems)
      {
        foreach (TableCell cell in item.Cells)
        {
          cell.Style["font-family"] = "Verdana";
          cell.Style["text-align"] = "left";
          cell.Style["vertical-align"] = "middle";
          cell.Style["font-size"] = "10px";
          cell.Style["background-color"] = "red";
        }
      }
    }//end of ApplyStylesToPDFExport
Kostadin
Telerik team
 answered on 23 Nov 2012
1 answer
174 views
Hi
     How can I open the radwindow on clicking the appointment of radscheduler.

RT
Princy
Top achievements
Rank 2
 answered on 23 Nov 2012
2 answers
77 views
I'm using the documentation and online source to try and build my own CustomDBProvider and CustomContentProvider.  I'm running into some issues and was hoping to get some help.  My goal is to have some "top-level" folders which will dynamically query a third-party system (via a COM SDK) and display folders and/or documents.  One of the top-level folders might be called "My Documents" and should only show documents.  Another might be called "My folders" and could show folders (which might in-turn have sub-folders).  Another example would be "My Labels" which might contain either documents or folders.  I"m using some static pathing so that I know how to execute different commands in the third party system.  I can't use DataTables because I need to load the information on-demand.  

For now I just want things to be displayed in the UI.  I've made everything read-only.  I'm not worried about uploading at this point.

I've gotten the "My Documents" to work perfectly.  But I can't get "My Containers" to work.  It executes the code and loads the directories into the function, but nothing gets displayed.  Any help would be greatly appreciated!



public override DirectoryItem ResolveRootDirectoryAsTree(string path)
{
    DirectoryItem directory = null;
    if (path.Equals("ROOT/TE"))
    {
        directory = new DirectoryItem("File Explorer", "ROOT/TE", "ROOT/TE", "ROOT/TE", PathPermissions.Read, null, null);
        List<DirectoryItem> subDirs = new List<DirectoryItem>();
        subDirs.Add(new DirectoryItem("My Labels", string.Empty, "ROOT/TE/TL-1", "TL-1", PathPermissions.Read, null, null));
        subDirs.Add(new DirectoryItem("Recent Documents", string.Empty, "ROOT/TE/TL-2", "TL-2", PathPermissions.Read, null, null));
        subDirs.Add(new DirectoryItem("Recent Folders", string.Empty, "ROOT/TE/TL-3", "TL-3", PathPermissions.Read, null, null));
        directory.Directories = subDirs.ToArray();
        if (directory.Directories != null)
        {
 
            foreach (DirectoryItem dir in directory.Directories)
            {
                dir.Permissions = GetPermissions(path);
            }
        }
        return directory;
    } else {
        return directory;
    }
}

public override DirectoryItem ResolveDirectory(string path)
{
    DirectoryItem directory = dataServer.GetDirectoryItem(path, true, true);
    if (directory == null) return null;
    return directory;
}

public DirectoryItem GetDirectoryItem(string path, bool bIncludeSubfolders, bool bIncludeFiles)
{
    DirectoryItem diDirectory = null;
    MyObject item = this.GetObjectFromPath(path);
    if (item != null )
    {
        if (item.sType.Equals("TL"))
        {
            diDirectory = LoadSubNode(item, path, bIncludeSubfolders, bIncludeFiles);
        }
        else if (item.sType.Equals("C"))
        {
            //diDirectory = CreateDirectoryItem(item, true);
        }
        else if (item.sType.Equals("FP"))
        {
            //diDirectory = CreateDirectoryItem(item, true);
        }
        else if (item.sType.Equals("UL"))
        {
            //diDirectory = CreateDirectoryItem(item, true);
        }
    }
    return diDirectory;
    //return (item != null && item.sType.Equals("C")) ? this.CreateDirectoryItem(item, includeSubfolders) : null;
}
 
private DirectoryItem LoadSubNode(MyObject ktoItem, string sPath, bool bIncludeSubFolders, bool bIncludeFiles) {
    DirectoryItem diDirectory = null;
    if (ktoItem.sUri.Equals("2"))
    {
        diDirectory = GetTopLevel_RecentDocuments(sPath, bIncludeFiles);
    }
    else if (ktoItem.sUri.Equals("3"))
    {
        diDirectory = GetTopLevel_RecentContainers(sPath, bIncludeSubFolders, bIncludeFiles);
    }
    return diDirectory;
}
 
 
private DirectoryItem GetTopLevel_RecentDocuments(string sPath, bool bIncludeFiles) {
    DirectoryItem diDirectory = new DirectoryItem("Recent Documents", sPath, sPath, "TL-2", PathPermissions.Read, null, null);
    if (bIncludeFiles)
    {
        diDirectory.Files = LoadRecentDocuments(sPath);
    }
    return diDirectory;
}
private DirectoryItem GetTopLevel_RecentContainers(string sPath, bool bIncludeSubFolders, bool bIncludeFiles)
{
    DirectoryItem diDirectory = null;
    diDirectory = new DirectoryItem("Recent Containers", sPath, sPath, "TL-3", PathPermissions.Read, null, null);
    SomeSDK.Records tRecords = tDatabase.MakeRecords();
    tRecords.SearchString = "myContainers";
    SomeSDK.Record tRecord = null;
    List<DirectoryItem> diFolders = new List<DirectoryItem>();
    while ((tRecord = tRecords.Next()) != null)
    {
        string sItemPath = GetValidPath(sPath) + "C-" + tRecord.Uri.ToString();
        DirectoryItem diSubItem = new DirectoryItem(tRecord.Title + " (" + tRecord.Number + ")", sItemPath, sItemPath, sItemPath, PathPermissions.Read, null, null);
        diSubItem.Files = (new List<FileItem>()).ToArray();
        diSubItem.Directories = (new List<DirectoryItem>()).ToArray();
        //diFolders.Add(new DirectoryItem(tRecord.Title + " (" + tRecord.Number + ")", sItemPath, sItemPath, sItemPath, PathPermissions.Read, null, null));
        diFolders.Add(diSubItem);
        //diFolders.Add(new DirectoryItem("test", string.Empty, sPath + "/1", "1", PathPermissions.Read, null, null));
    }
    diDirectory.Directories = diFolders.ToArray();
    List<FileItem> fiDocuments = new List<FileItem>();
    diDirectory.Files = fiDocuments.ToArray();
    return diDirectory;
}
 
private FileItem[] LoadRecentDocuments(string sPath)
{
    SomeSDK.Records tRecords = tDatabase.MakeRecords();
    tRecords.SearchString = "myDocuments";
    SomeSDK.Record tRecord = null;
    List<FileItem> fiDocuments = new List<FileItem>();
    while ((tRecord = tRecords.Next()) != null)
    {
        string sItemPath = GetValidPath(sPath) + "D-" + tRecord.Uri.ToString();
        fiDocuments.Add(new FileItem(tRecord.Title + " (" + tRecord.Number + ")", tRecord.Extension, tRecord.DocumentSize, sItemPath, sItemPath, tRecord.Number, PathPermissions.Read));
    }
    return fiDocuments.ToArray();
}
private string GetValidPath(string sInputPath)
{
    if (!sInputPath.EndsWith("/"))
    {
        return sInputPath + "/";
    }
    else
    {
        return sInputPath;
    }
}
Vessy
Telerik team
 answered on 23 Nov 2012
13 answers
141 views
Hi All

I've just noticed this , (been messing around with the app and didn't notice when this happened)
I have RagGrids with a COmmandName = Delete. This I think is a build in command.

The icon doesn't show for this. If I change the command name to a diffferent name other than the built in one (DeleteZ) the icon shows.

Also all the icons have disappeared from the reporting module too.

Andy Ideas.

Andy
Andy Green
Top achievements
Rank 2
 answered on 23 Nov 2012
1 answer
89 views
Hi there,
     How do I highlight todays date in grid date filter. thanks for the help
Savyo
Shinu
Top achievements
Rank 2
 answered on 23 Nov 2012
1 answer
67 views
Hi
How can I hide the undobutton in the radspell dialog box. Thanks

Allen
Princy
Top achievements
Rank 2
 answered on 23 Nov 2012
3 answers
166 views
I'm using a RadColorPicker replacing the standard ForeColor tool in RadEditor.

 

 

<script type="text/javascript">

 

RadEditorCommandList[

 

 try

 

if (editor.getSelectionHtml() != "") {  

 

     var style = editor.get_contentArea().style;
    style.color = oTool.value; 

    if (ajaxManager == null

            ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");

  

    if (ajaxManager != null)

             ajaxManager.ajaxRequest(commandName);

    }

 

else

    alert("Please, select some text!");  

    args.set_cancel(true);  

    }

catch (err)

{ }

}

 

 

Rumen
Telerik team
 answered on 23 Nov 2012
1 answer
138 views
How to hide lines and change expand icon of treeview?
Shinu
Top achievements
Rank 2
 answered on 23 Nov 2012
1 answer
57 views

Hi,

I am trying to get the telerik hierachy grid to work. I got the grid row to show up when the grid is loaded. When I click on the arrow to expand the first row, the row expands. I see the two tab page and the first tab grid data is loaded. However when I click on the 2nd tab, nothing happens. when I clicked the 2nd or 3rd row, it is not expand. It just display a blank line.

 Any help is greatly appreciated.

JC

<

 

 

telerik:RadGrid ID="rgdSubmitterMatrix" runat="server" AllowSorting="True" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="odsSubmitterNotice" GridLines="None" OnItemDataBound="rgdSubmitterMatrix_ItemDataBound" OnPreRender="Page_Load" ShowGroupPanel="True" Skin="Outlook" >

<PagerStyle Mode="NumericPages" />

 

<mastertableview allowmulticolumnsorting="True" datasourceid="odsSubmitterNotice" GroupLoadMode="server">

 <NestedViewTemplate>

<asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">

<telerik:RadTabStrip runat="server" ID="rtsSubmitterMatrix" MultiPageID="rmpSubmitterMatrix" SelectedIndex="0">

<Tabs>

<telerik:RadTab runat="server" Text="Submitter Response" PageViewID="rpvSubmitterResponse">

</telerik:RadTab>

<telerik:RadTab runat="server" Text="Determination Notice" PageViewID="rpvDeterminationNotice">

</telerik:RadTab>

</Tabs>

</telerik:RadTabStrip>

<telerik:RadMultiPage runat="server" ID="rmpSubmitterNotice" SelectedIndex="0" RenderSelectedPageOnly="false">

<telerik:RadPageView runat="server" ID="rpvSubmitterResponse">

<asp:Label ID="lblSubmitterResponse" Font-Bold="true" Font-Italic="true" Text="Submitter Response"

Visible="false" runat="server"></asp:Label>

<telerik:RadGrid runat="server" ID="rgdSubmitterNotice" DataSourceID="odsSubmitterResponse" ShowFooter="true"

AllowSorting="true" EnableLinqExpressions="false">

<MasterTableView ShowHeader="true" AutoGenerateColumns="false" AllowPaging="true"

DataKeyNames="FAC_RECORD_UID" PageSize="10" HierarchyLoadMode="ServerOnDemand">

<Columns>

<telerik:GridBoundColumn SortExpression="FAC_RECORD_UID" HeaderText="OASIS #" HeaderButtonType="TextButton" DataField="FAC_RECORD_UID" UniqueName="FAC_RECORD_UID">

</telerik:GridBoundColumn>

<telerik:GridDateTimeColumn SortExpression="DATE_RECEIVED" HeaderText="Received Date" HeaderButtonType="TextButton"

DataField="DATE_RECEIVED" UniqueName="DATE_RECEIVED" DataFormatString="{0:MM/dd/yyyy}">

</telerik:GridDateTimeColumn>

<telerik:GridBoundColumn SortExpression="RESPONSE_VALUE" HeaderText="Response" HeaderButtonType="TextButton" DataField="RESPONSE_VALUE" UniqueName="RESPONSE_VALUE">

</telerik:GridBoundColumn>

</Columns>

</MasterTableView>

</telerik:RadGrid>

</telerik:RadPageView>

<telerik:RadPageView runat="server" ID="rpvDeterminationNotice">

<asp:Label ID="lblDeterminationNotice" Font-Bold="true" Font-Italic="true" Text="Determination Notice"

Visible="false" runat="server"></asp:Label>

<telerik:RadGrid runat="server" ID="rgdDeterminationNotice" DataSourceID="odsDeterminationNotice" ShowFooter="true"

AllowSorting="true" EnableLinqExpressions="false">

<MasterTableView ShowHeader="true" AutoGenerateColumns="false" AllowPaging="true"

DataKeyNames="FAC_RECORD_UID" PageSize="10" HierarchyLoadMode="ServerOnDemand">

<Columns>

<telerik:GridBoundColumn SortExpression="FAC_RECORD_UID" HeaderText="OASIS #" HeaderButtonType="TextButton" DataField="FAC_RECORD_UID" UniqueName="FAC_RECORD_UID">

</telerik:GridBoundColumn>

<telerik:GridDateTimeColumn SortExpression="DATE_SENT" HeaderText="Date Sent" HeaderButtonType="TextButton"

DataField="DATE_SENT" UniqueName="DATE_SENT" DataFormatString="{0:MM/dd/yyyy}">

</telerik:GridDateTimeColumn>

<telerik:GridDateTimeColumn SortExpression="DOCUMENT_RELEASE_DATE" HeaderText="Document Release Date" HeaderButtonType="TextButton"

DataField="DOCUMENT_RELEASE_DATE" UniqueName="DOCUMENT_RELEASE_DATE" DataFormatString="{0:MM/dd/yyyy}">

</telerik:GridDateTimeColumn>

<telerik:GridBoundColumn SortExpression="REMARKS" HeaderText="Remarks" HeaderButtonType="TextButton" DataField="REMARKS" UniqueName="REMARKS">

</telerik:GridBoundColumn>

</Columns>

</MasterTableView>

</telerik:RadGrid>

</telerik:RadPageView>

</telerik:RadMultiPage>

</asp:Panel>

</NestedViewTemplate>

<Columns>

<telerik:GridBoundColumn SortExpression="OASIS_NUMBER" HeaderText="Submitter Notice OASIS #" HeaderButtonType="TextButton" DataField="OASIS_NUMBER" UniqueName="OASIS_NUMBER">

</telerik:GridBoundColumn>

<telerik:GridDateTimeColumn SortExpression="DATE_SENT" HeaderText="Submitter Notice Date Sent" HeaderButtonType="TextButton" DataField="DATE_SENT" UniqueName="DATE_SENT" DataFormatString="{0:MM/dd/yyyy}">

</telerik:GridDateTimeColumn>

<telerik:GridDateTimeColumn SortExpression="DATE_DUE" HeaderText="Submitter Notice Date Due" HeaderButtonType="TextButton" DataField="DATE_DUE" UniqueName="DATE_DUE" DataFormatString="{0:MM/dd/yyyy}">

</telerik:GridDateTimeColumn>

</Columns>

</mastertableview>

<clientsettings allowdragtogroup="False">

<Scrolling AllowScroll="True" UseStaticHeaders="True" />

</clientsettings>

<headercontextmenu enableautoscroll="True">

</headercontextmenu>

</telerik:RadGrid>

 




public

partial class SubmitterMatrix : System.Web.UI.UserControl

 {

 

 

protected void Page_Load(object sender, EventArgs e)

{

if (!Page.IsPostBack)

 {

 

 

if (rgdSubmitterMatrix.MasterTableView.Items.Count > 0)

 

{

rgdSubmitterMatrix.MasterTableView.Items[0].Expanded =

 

true;

 

rgdSubmitterMatrix.MasterTableView.Items[0].ChildItem.FindControl(

 

"InnerContainer").Visible = true;

 

}

 

}

 

 

protected void rgdSubmitterMatrix_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)

 {

 }

 

 

protected void rgdSubmitterMatrix_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

 {

}

 

 

protected void rgdSubmitterMatrix_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)

 {

if (e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item is GridDataItem)

{

((GridDataItem)e.Item).ChildItem.FindControl("InnerContainer").Visible = !e.Item.Expanded;

}

}

 

 

protected void rgdSubmitterMatrix_ItemCreated(object sender, GridItemEventArgs e)

{

if (e.Item is GridNestedViewItem)

{

e.Item.FindControl("InnerContainer").Visible = ((GridNestedViewItem)e.Item).ParentItem.Expanded;

}

}

 

 

protected void odsSubmitterNotice_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)

{

}

 

 

protected void odsSubmitterNotice_Selected(object sender, ObjectDataSourceStatusEventArgs e)

{

}

 

 

protected void odsSubmitterResponse_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)

{

}

 

 

protected void odsDeterminationNotice_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)

{

}


Eyup
Telerik team
 answered on 23 Nov 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?