Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
130 views
Hello,

To Print  Grid Data With all paging  & Filter Data, i use this program (from : http://www.telerik.com/community/forums/aspnet-ajax/grid/how-to-print-grid-data-with-all-paging.aspx ) :
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Testing.aspx.vb" Inherits="Aspen.Testing" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 
<head runat="server">
    <title>Telerik Print Fucntion</title>
<telerik:RadCodeBlock runat ="server" ID= "ClientExport">
<script type = "text/javascript" >
          
    function getOuterHTML(obj){
           if (typeof (obj.outerHTML) == 'undefined')
                {
                      var divWrapper = document.createElement("div");
                      var copyOb = obj.cloneNode(true);
                      divWrapper.appendChild(copyOb);
                      return divWrapper.innerHTML
                }
            else
         return obj.outerHTML;
 }
 function PrintRadGrid( ){  
            var radGrid = $find('RadGrid1');
             
            var previewWnd = window.open('about:blank', '', '', false);
            var sh = '<%= ClientScript.GetWebResourceUrl(RadGrid1.GetType(),String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css",radGrid1.Skin)) %>';
            var styleStr = "<html><head><link href = '" + sh + "' rel='stylesheet' type='text/css'></link></head>";
            var htmlcontent = styleStr + '<body>' + getOuterHTML($find('RadGrid1').get_element()) + '</body></html>'; 
            previewWnd.document.open();
            previewWnd.document.write(htmlcontent);
            previewWnd.document.close();
            previewWnd.print();
            previewWnd.close();       
 }  
     
 </script>
 </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
      <AjaxSettings >
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID ="btnExport">
            <UpdatedControls >
                <telerik:AjaxUpdatedControl ControlID ="btnExport" />
            </UpdatedControls>
            </telerik:AjaxSetting>
           </AjaxSettings>
    </telerik:RadAjaxManager>
    <div>
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging ="true"
            Width="493px" >
        <ExportSettings FileName ="Hello" Excel-FileExtension ="xls" OpenInNewWindow ="true" IgnorePaging ="true" ></ExportSettings>
            <MasterTableView>
                 <RowIndicatorColumn>
                     <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
 
                <ExpandCollapseColumn>
                     <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
            </MasterTableView>
            <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
            </ClientSettings>
        </telerik:RadGrid>
    </div>
    <input ID="btnPrint" runat="server" type="button"   onclick="PrintRadGrid();" value="Print Grid Data5" />
    </form>
</body>
</html>


this solution works in IE and Firefox but it does not work in chrome. The result is empty.
Do you have this problem in Chrome? Do you have a solution in chrome?

Pavlina
Telerik team
 answered on 12 Oct 2012
1 answer
92 views
Hello!

I am having a disagreement with a co-worker on the design of web pages that are using the RadGrid as the primary control. In his design he suggests that the grid should be build dynamically, adding columns and properties, etc. in the on_Init event. My suggested design is that the layout for the grid be done in the web page markup and using the page/grid events for only functionality and binding. The radgrid on the page needs to do some very complicated tasks and act like an excel spreadsheet. In our spreadsheet style control it will have a master/detail view and include custom filtering and incorporate event handling such as the double click event and right click event. Now, in my version of the design I plan to use the NeedDataSource to bind a datatable; however, he believes that the datafield can be set dynamically as well. Can you provide a brief list of pro's and con's for each of the two approaches to designing the webpage grid layouts?

Thanks,

Steve Holdorf
Maria Ilieva
Telerik team
 answered on 12 Oct 2012
1 answer
106 views
I have a user control which has a combobox and two label.  The user control will be created inside of RadContextMenu.  I like to access label witnin this user control from Javacript.  Can you help me point out how I can do this?

User Control Definition

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Sample_CheckComboBox.ascx.cs" Inherits="StoneHorse3.Controls.Sample_CheckComboBox" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<br />
<table cellpadding="0" cellspacing="1"  width="88">
    <tr>    
        <td>
            <telerik:RadButton ID="btnFilter" runat="server" Text="Apply" Width="39px" Height="25px" OnClick="btnFilter_Click" >
                <Image ImageUrl="~/Images/bloombergyellowsmall.png" IsBackgroundImage="true" />
            </telerik:RadButton>                           
        </td>       
        <td>
            <telerik:RadButton ID="btnClear" runat="server" Text="Clear" Width="39px" Height="25px" onclick="btnFilterClear_Click"  >
                <Image ImageUrl="~/Images/bloombergyellowsmall.png" IsBackgroundImage="true" />
            </telerik:RadButton
        </td>
    </tr>
    <tr >
        <asp:Label ID="Label1" runat="server" Text=" "></asp:Label>
    </tr>       
    <tr>
        <th colspan="2">
            <telerik:RadComboBox ID="cmbFieldList" runat="server" AutoPostBack="true"
            OnItemDataBound="cmbFieldList_ItemDataBound" Style="z-index: 9000"
            OnClientDropDownClosing="radComboBox_OnClientDropDownClosing" OnClientDropDownOpening="radComboBox_OnClientDropDownOpening"
            >
            </telerik:RadComboBox>                   
            <asp:Label ID="lblFieldName" runat="server" Text="" ></asp:Label>
            <asp:Label ID="lblSectorID" runat="server" Text="" ></asp:Label>
        </th>                     
    </tr>
</table>
<br />

the label I like to gain access to are "lblFieldName" and "lblSectionID"

In Javascript I want to assign colUniqueName and sectorid to each of these two labels.

var filteredColId = "";
function showMenu(event, colUniqueName, filtertype, sectorid) {
            $find("<%=rcmCheckCombo.ClientID%>").show(event);
            ???lblFieldName= colUniqueName;
            ???lblSectorID= sectorid;
    }
}
How can I do something like this?  what would be the proper syntax? 

Thanks

Mark
Boyan Dimitrov
Telerik team
 answered on 12 Oct 2012
7 answers
203 views
Hi,

Is there any way to have a "Show all" option on the pager for the Grid?

Thanks,
Dewang
Rohan
Top achievements
Rank 1
 answered on 12 Oct 2012
1 answer
112 views
I 'm facing with the problem of PageIndex change doesn't work in my grid.I try to research with another Radgrid view's page index is working well.Could u pls check below grid?

          <telerik:RadGrid ID="RadGrid2" runat="server"  
                            AllowPaging="true"
                          GridLines="Horizontal" AutoGenerateColumns="False" 
                            onitemcommand="Edit_Command">
                            <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                                <Selecting AllowRowSelect="True" />
                            </ClientSettings>
                            <MasterTableView DataKeyNames="ID" AllowMultiColumnSorting="True">
                                <CommandItemSettings ExportToPdfText="Export to PDF" />
                                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" 
                                    Visible="True">
                                    <HeaderStyle Width="20px" />
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" 
                                    Visible="True">
                                    <HeaderStyle Width="20px" />
                                </ExpandCollapseColumn>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="ID" FilterControlAltText="Filter ID column" 
                                        HeaderText="ID" SortExpression="ID" UniqueName="ID" Visible="false">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="DOID" 
                                        FilterControlAltText="Filter DOID column" HeaderText="Ref No" 
                                        SortExpression="DOID" UniqueName="DOID">
                                    </telerik:GridBoundColumn>
                                  <%--  <telerik:GridBoundColumn DataField="DeliveryDate" DataType="System.DateTime" DataFormatString="{0:dd/MM/yyyy}"
                                        FilterControlAltText="Filter DeliveryDate column" HeaderText="DeliveryDate" 
                                        SortExpression="DeliveryDate" UniqueName="DeliveryDate">
                                    </telerik:GridBoundColumn>--%>
                                    <telerik:GridBoundColumn DataField="ExpectedDate" DataType="System.DateTime" DataFormatString="{0:dd/MM/yyyy}"
                                        FilterControlAltText="Filter ExpectedDate column" HeaderText="ExpectedDate" 
                                        SortExpression="ExpectedDate" UniqueName="ExpectedDate">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="ConsignmentType" 
                                        FilterControlAltText="Filter ConsignmentType column" 
                                        HeaderText="ConsignmentType" SortExpression="ConsignmentType" 
                                        UniqueName="ConsignmentType">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Reason" 
                                        FilterControlAltText="Filter Reason column" HeaderText="Reason" 
                                        SortExpression="Reason" UniqueName="Reason">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Status" 
                                        FilterControlAltText="Filter Status column" HeaderText="Status" 
                                        SortExpression="Status" UniqueName="Status">
                                    </telerik:GridBoundColumn>
                                   <telerik:GridEditCommandColumn ButtonType="ImageButton"
                                UniqueName="EditCommandColumn">
                            </telerik:GridEditCommandColumn>
                                </Columns>
                                <EditFormSettings>
                                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                    </EditColumn>
                                </EditFormSettings>
                            </MasterTableView>
                            <FilterMenu EnableImageSprites="False">
                            </FilterMenu>
                        </telerik:RadGrid>

I do appreciate every suggestion.Thanks.
Andrey
Telerik team
 answered on 12 Oct 2012
1 answer
232 views
I am dynamically building a grid control on the PAGE_LOAD event. Column headers and data are all bound on the fly, nothing is static. I am using the the Filter Icons and have set AllowMultiColumnSorting = "TRUE".

I am able to sort only by one column. When I try to enter data into a second field to sort by a second field, my first sort value goes away. What is needed to keep these sort values?

Here is some code to help you understand how my grid is built.

All help is greatly appreciated!

Dim RadGrid1 As RadGrid = New RadGrid
 
RadGrid1.ID = "RadGrid1"
RadGrid1.Width = Unit.Percentage(100)
RadGrid1.PageSize = 5
RadGrid1.AllowPaging = True
RadGrid1.AllowSorting = True
RadGrid1.AllowFilteringByColumn = True
RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric
RadGrid1.PagerStyle.Position = GridPagerPosition.TopAndBottom
RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.TopAndBottom
RadGrid1.MasterTableView.CommandItemStyle.BackColor = Color.LightGray
RadGrid1.MasterTableView.CommandItemStyle.ForeColor = Color.Black
RadGrid1.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = False
RadGrid1.MasterTableView.CommandItemSettings.ShowExportToPdfButton = True
RadGrid1.MasterTableView.CommandItemSettings.ShowExportToExcelButton = True
RadGrid1.MasterTableView.AllowFilteringByColumn = True
RadGrid1.ExportSettings.ExportOnlyData = True
RadGrid1.AutoGenerateColumns = False
RadGrid1.Skin = "MetroTouch"
RadGrid1.BorderStyle = BorderStyle.None
RadGrid1.MasterTableView.HeaderStyle.ForeColor = Color.White
RadGrid1.MasterTableView.EnableColumnsViewState = False
RadGrid1.MasterTableView.PageSize = 15
RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace
RadGrid1.MasterTableView.AllowMultiColumnSorting = True

Dim tblStopData As DataTable = New DataTable
 
            Dim cmd As SqlCommand = New SqlCommand("SP_STORED_PROC", conn)
 
            cmd.CommandType = CommandType.StoredProcedure
 
            Dim adapter As New SqlDataAdapter(cmd)
            adapter.SelectCommand.CommandTimeout = 300
 
            adapter.Fill(tblStopData)
 
            Dim name(tblStopData.Columns.Count) As String
            Dim i As Integer = 0
            For Each column As DataColumn In tblStopData.Columns
                Dim boundColumn As GridBoundColumn = New GridBoundColumn
                RadGrid1.MasterTableView.Columns.Add(boundColumn)
                boundColumn.DataField = column.ColumnName
                boundColumn.HeaderText = column.ColumnName
                'boundColumn.AndCurrentFilterFunction = GridKnownFunction.Contains
                boundColumn.ShowFilterIcon = True
            Next
 
            RadGrid1.DataSource = tblStopData
            RadGrid1.Rebind()
Eyup
Telerik team
 answered on 12 Oct 2012
2 answers
141 views
Hi,

My grid was exporting okay before I added a footer. Kostadin helped me get the dynamic footer working, but after clicking the export button, I get a null reference exception during PreRender where the data items are accessed in order to populate the footer.

I have set EnableViewState to false, set export settings in the button control, and added an update panel with a post back trigger on the button to no avail.

protected void Button1_Click(object sender, EventArgs e)
{
    RadGrid grid = (RadGrid)PlaceHolder1.FindControl("RadGrid1");
 
    grid.AllowSorting = false;
    grid.Columns.FindByUniqueName("EditCommandColumn").Visible = false;
    grid.ExportSettings.ExportOnlyData = true;
    grid.ExportSettings.IgnorePaging = true;
    grid.ExportSettings.OpenInNewWindow = true;
    grid.ExportSettings.FileName = "WastewaterExport";
 
    grid.MasterTableView.ExportToExcel();
}

Any ideas?

Thanks,
David
Kostadin
Telerik team
 answered on 12 Oct 2012
1 answer
105 views

I have a RadFilter with a custom FieldEditor control inside the <FieldEditors></FieldEditors> tags.

The custom field control is a class inherited from RadFilterDataFieldEditor.

In the InitializeEditor(System.Web.UI.Control container) method, a RadComboBox is instantiated and
added to the Controls collection of the container parameter.   The DataTextField property of the RadComboBox is text while the DataValueField property of the RadComboBox is a numeric value corresponding to the text's numeric ID.

When a filter expression is added, the dropdown listbox is displayed for selecting the filter value as the text.  However once the RadFilter Apply button is clicked on postback, the combobox changes to a textbox with the numeric value.

Can't figure out why this is happening.  Could use some help!  Thanks in advance.

 

Tsvetina
Telerik team
 answered on 12 Oct 2012
5 answers
501 views
2009.3.1210.35



DetailTables does not have ClientSettings.
In Master table I have these two defined to true but I want them false in the Detail Table.

Selecting-AllowRowSelect="false" EnableRowHoverStyle="false"

Please advise, thanks.
Eyup
Telerik team
 answered on 12 Oct 2012
1 answer
71 views
Hello

I've problem with my website when I use IE9. The rendering is different...

First config : IIS6.1 : OK
Second config : IIS6.0 (WS2003) : not OK

When I examine the CSS style (in IE9 developpement tools), I can see html class prefixed by "_Telerik_IE9" on 1st config, but not on the 2nd...

Is it normal ? Did I forget something ?

Best regards,
MI87
Top achievements
Rank 1
 answered on 12 Oct 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?