Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
268 views
Hello,
I want to print grid content. I refer http://www.telerik.com/support/code-library/print-radgrid-contents this link.
referring this link print operation perform perfectly but I want to remove some attributes of grid like "allowscrolling,usestaticheader etc" at the time of print grid and after print  grid that property again bind to grid.
I am trying this two ways

1.st_approch
On Code Behind
protected void Page_Load(object sender, EventArgs e)
       {
            
               radgrid.ClientSettings.Scrolling.UseStaticHeaders = true;
               radgrid.ClientSettings.Scrolling.AllowScroll = true;
               radgrid.ClientSettings.Scrolling.SaveScrollPosition = true;
       }
protected void btn_print_Click(object sender, EventArgs e)
       {
             radgrid.ClientSettings.Scrolling.UseStaticHeaders = false;
               radgrid.ClientSettings.Scrolling.AllowScroll = false;
               radgrid.ClientSettings.Scrolling.SaveScrollPosition = false;
           ScriptManager.RegisterStartupScript(this, typeof(Page), "myscript", "function pageLoad(){PrintRadGrid();}", true);
       }
.aspx page
function PrintRadGrid() {
  
            $find("<%=radgrid.ClientID %>").get_masterTableView().hideFilterItem();
         
            var previewWnd = window.open('about:blank', '', '', false);
            var sh = '<%= ClientScript.GetWebResourceUrl(radgrid.GetType(),String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css",radgrid.Skin)) %>';
            var styleStr = "<html><head><link href = '" + sh + "' rel='stylesheet' type='text/css'></link></head>";
            var htmlcontent = styleStr + "<body>" + $find('<%= radgrid.ClientID %>').get_element().outerHTML + "</body></html>";
            previewWnd.document.open();
            previewWnd.document.write(htmlcontent);
            previewWnd.document.close();
            previewWnd.print();
 
            if (!$telerik.isChrome) {
                previewWnd.close();
            }
            $find("<%=radgrid.ClientID %>").get_masterTableView().showFilterItem();          
    }

2.nd_approch
.aspx
function PrintRadGrid() {
             $find("<%=radgrid.ClientID %>").get_masterTableView().hideFilterItem();
             var radGrid = $find("<%= radgrid.ClientID %>");
             radGrid.ClientSettings.Scrolling.AllowScroll = false;
             radGrid.ClientSettings.Scrolling.UseStaticHeaders = false ;
            radGrid.ClientSettings.Scrolling.SaveScrollPosition=false;
             
              
             var previewWnd = window.open('about:blank', '', '', false);
             var sh = '<%= ClientScript.GetWebResourceUrl(radgrid.GetType(),String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css",radgrid.Skin)) %>';
             var styleStr = "<html><head><link href = '" + sh + "' rel='stylesheet' type='text/css'></link></head>";
             var htmlcontent = styleStr + "<body>" + $find('<%= radgrid.ClientID %>').get_element().outerHTML + "</body></html>";
             previewWnd.document.open();
             previewWnd.document.write(htmlcontent);
             previewWnd.document.close();
             previewWnd.print();
 
             if (!$telerik.isChrome) {
                 previewWnd.close();
             }
             $find("<%=radgrid.ClientID %>").get_masterTableView().showFilterItem();
             radGrid.ClientSettings.Scrolling.AllowScroll = true;
             radGrid.ClientSettings.Scrolling.UseStaticHeaders = true;
             radGrid.ClientSettings.Scrolling.SaveScrollPosition = true;
     }
and the above print code call on button onclientclick event
above both ways not working to achieve the task.
So please tell me how achieve this task.
Testing
Top achievements
Rank 1
 answered on 18 Apr 2014
5 answers
160 views
I have a simple  textbox and a simple dropdownlist like this:
<asp:TextBox ID="txtState" runat="server" Width="200px" AutoPostBack="true"    ></asp:TextBox>
 <asp:DropDownList ID="cboCities" runat="server"  Width="200px" AutoPostBack="true" >  </asp:DropDownList> 

When the user enters a state in the textbox, I want to fill the dropdownlist with appropriate cities. I am using an Open Access Data Model.I have tried several different ways to bind the dropdownlist in the page’s load complete event when it detects that txtState.text <> “” and cboCities.items.count = 0

'Attempt 1
 'No errors but no values filled either. If it did work I would want to replace the where clause with c.State = txtState.text
Using model As New MyDataModel.EntitiesModel
       Dim Stations As List(Of City) = (From c In model.Cities Where c.State = "MA" _ And c.IsActive = 1).ToList
       If Not Stations Is Nothing Then
            cboCities.DataSource = Stations
            cboCities.DataBind()
       End If
End Using

'Attempt 2 
  ''this one works but doesn't have the ability to filter by state. DBContext is defined on the DataAccesPage which this page inherits from
  cboCities.DataSource = DbContext.Cities.ToList()
  cboCities.DataTextField = "CityID"
  cboCities.DataBind()

   'Attempt 3
'THIS ONE WORKS TO FILL THE CBO BUT ANY CODE AFTER THIS THROWS ERRORS I really wanted this one to work because it calls a function in my '     'BLL (FillCitiesList) which seems the most “Proper” way to go about it

Dim listStations As IQueryable(Of CanFillStation)
listStations = FillCitiesList ("MA”)
cboCities.DataSource = listStations
cboCities.DataBind() 

Public Function FillCitiesList (ByVal stState As String) As IQueryable(Of City)
        Using model As New MyDataModel.EntitiesModel
            Dim query = From c In model.Cities Where c.State = strState
               Select c
            Return query
        End Using
    End Function 

This is the error message that is thrown after attempt 3 code executes:
System.ObjectDisposedException was unhandled by user code  Message=The ObjectScope has already been disposed and it's managed persistent objects can no longer be accessed. The ObjectScope should be disposed at the end of the life cycle of your business logic instance. This can also be done in the Dispose of your ASP page or MVC controller.Object name: 'OpenAccessRuntime.EnlistableObjectScope'.  ObjectName=OpenAccessRuntime.EnlistableObjectScope  Source=Telerik.OpenAccess.Runtime  StackTrace:       at OpenAccessRuntime.ObjectScope.CheckNotDisposed()       at OpenAccessRuntime.ObjectScope.Telerik.OpenAccess.SPI.IExtendedObjectScope.get_ShouldLogExpressions()       at Telerik.OpenAccess.Query.ExtentQueryImpl`1.Telerik.OpenAccess.Query.ExecutionSettings.get_ShouldLogExpressions()       at Telerik.OpenAccess.Query.ExpressionCutter.CutAndExecute(Expression expression, ExecutionSettings settings, Expression whole)       at Telerik.OpenAccess.Query.Piece`1.ExecuteMultiple()       at Telerik.OpenAccess.Query.Piece`1.System.Collections.IEnumerable.GetEnumerator()       at System.Web.UI.WebControls.ListControl.PerformDataBinding(IEnumerable dataSource)       at System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e)       at System.Web.UI.WebControls.ListControl.PerformSelect()       at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()       at ELSATracking.EditRelations.Page_LoadComplete(Object sender, EventArgs e) in C:\_DEVELOPMENT\ELSATracking\ELSATracking\UserPages\Shop\EditRelations.aspx.vb:line 132       at System.Web.UI.Page.OnLoadComplete(EventArgs e)       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  InnerException:


Obviously, I don't know what I'm doing! Can anyone help me fill the dropdownlist programatically after the user enters a state, using OpenAccess, and preferably using a business layer function?

Thanks
Doroteya
Telerik team
 answered on 18 Apr 2014
1 answer
69 views
Hello,
I noticed that the PivotTable control is not compatible with touchscreen tablet on Windows 8.
How do I use it better?

Thanks
Francesco
Dimitar
Telerik team
 answered on 18 Apr 2014
1 answer
88 views
Just curious if it works before investing too much time into it.  I have tried to implement it and have had no luck.  Please advise.
Genady Sergeev
Telerik team
 answered on 18 Apr 2014
1 answer
64 views
Hello there,

i am using RADtreeview within my User Control (*.ascx). I also configured it to get its nodes from a webservice. So far so good, all is working fine as long as i open the Page with "http://". I see the Control is sending its request with POST to my WebService and gets all needed information to populate the Tree.

But as soon as i switch to "https://" the Control is asking the WebService with GET instead of POST. How to configure it to always send POST?

UseHttpGet="false" doens't change anything. Also my WebService only have a POST OperationContract.

WebService Contract:

[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
RadTreeNodeData[] GetNodes(RadTreeNodeData node, IDictionary<string, object> context);

User Control (*.ascx):

<telerik:RadTreeView
    ID="RadTreeView1"
    runat="server"
    Width="100%"
    PersistLoadOnDemandNodes=   "false"
    EnableViewState         =   "false"
    LoadingStatusPosition   =   "AfterNodeText"
     
    >
    <ExpandAnimation Type="none"></ExpandAnimation>
    <CollapseAnimation Type="none"></CollapseAnimation>
    <WebServiceSettings Path="http://localhost/_vti_bin/xxxx.xxxx.xxxx/myTopBarNavigation.svc" Method="GetNodes" UseHttpGet="false"></WebServiceSettings>
    <Nodes>
        <telerik:RadTreeNode Text="Root Node" ExpandMode="WebService">
        </telerik:RadTreeNode>
    </Nodes>
</telerik:RadTreeView>
Hristo Valyavicharski
Telerik team
 answered on 18 Apr 2014
1 answer
167 views
I have a grid looks with a RadButton for editing with paging allowed. Out of grid I have a button for filtering. The problem is when the session is lost, the buttons for editing not works neither buttons for paging.

In code design, it looks like this:

    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
    </telerik:RadStyleSheetManager>
    <telerik:RadAjaxManager ID="RadAjaxManager" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RbtFiltrar">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RgParametros"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadWindowManager ID="RadWindowManager" runat="server">
    </telerik:RadWindowManager>

    <telerik:RadGrid ID="RgParametros" AllowPaging="true" PageSize="14" runat="server"
        AutoGenerateColumns="False" GridLines="none" OnItemDataBound="RgParametros_ItemDataBound"
        EnableLinqExpressions="true" meta:resourcekey="RgParametros" OnNeedDataSource="RgParametros_NeedDataSource"
        OnSortCommand="RgParametros_SortCommand" OnDataBound="RgParametros_DataBound">
        <GroupingSettings CaseSensitive="False" />
        <PagerStyle PageSizeControlType="None" />
        <MasterTableView DataKeyNames="Id,Nombre" AllowSorting="true" TableLayout="Fixed"
            AllowMultiColumnSorting="true" HeaderStyle-HorizontalAlign="Center">
            <Columns>
                <telerik:GridBoundColumn UniqueName="ColCodigo" SortExpression="Id" DataField="Id"
                    meta:resourcekey="ColCodigo">
                    <ItemStyle Width="13%" Wrap="false" />
                    <HeaderStyle Width="13%" Wrap="false" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="ColNombre" SortExpression="Nombre" DataField="Nombre"
                    meta:resourcekey="ColNombre">
                    <ItemStyle Width="60%" Wrap="false" />
                    <HeaderStyle Width="60%" Wrap="false" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="ColTipo" SortExpression="Tipo" DataField="Tipo"
                    meta:resourcekey="ColTipo">
                    <ItemStyle Width="13%" Wrap="false" />
                    <HeaderStyle Width="13%" Wrap="false" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="ColValores" SortExpression="Valores" DataField="Valores"
                    meta:resourcekey="ColValores">
                    <ItemStyle Width="10%" Wrap="false" HorizontalAlign="Right" />
                    <HeaderStyle Width="10%" Wrap="false" />
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Right" UniqueName="ColEditar">
                    <ItemTemplate>
                        <telerik:RadButton ID="RbtEditar" runat="server" CausesValidation="false" OnClick="RbtEditar_Click"
                            Width="20px" Height="20px" Style="margin-right: 15px" HoveredCssClass="classHoveredImage"
                            DisabledButtonCssClass="classDisabledImage" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Id") %>'>
                            <Image EnableImageButton="true" ImageUrl="<%$ Resources:Iconos,VER_DETALLE %>" DisabledImageUrl="<%$ Resources:Iconos,VER_DETALLE_DISABLED %>"
                                HoveredImageUrl="<%$ Resources:Iconos,VER_DETALLE_HOVER %>" />
                        </telerik:RadButton>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
            <SortExpressions>
                <telerik:GridSortExpression FieldName="Id" SortOrder="Ascending" />
            </SortExpressions>
        </MasterTableView>
    </telerik:RadGrid>

Eyup
Telerik team
 answered on 18 Apr 2014
1 answer
133 views

Hi,
 I am getting telerik versioning exception in IE 10 browser. And i had attached the snapshot of that exception.So please help me.
       Telerik version  =  2014.1.225.40
Peter Filipov
Telerik team
 answered on 18 Apr 2014
1 answer
391 views
Hello Guys,

Right now I'm working with my clients to develop an Image viewer, using the components RadImageEditor and RadGrid. The RadGrid is implemented to be the thumbnail part of the viewer and each row is an image of the document, when its clicked loads the image.url to the Image Editor. I'm handling here documents so I want to make annotations, highlights, add text, rotate, crop, all the basic operations that an image viewer do. But I'm having some troubles. 1) The memory consumption its to high when each image is loaded, here its a script that change the route of the image with ajax, the image editor consumes more and more memory, there is an option to dispose the memory or maybe I'm loading wrong the images? 2)  The images are loaded fine in the beginning, and when you click each image I just change the image URL, also my images are in a share folder so all my access are fine, but when i try to do some operations of the Image Editor a java exception raises and the operations dialog are not loaded fine and don't work.

Do you have some tips to handle this better?

Thanks,
Javier
Vessy
Telerik team
 answered on 17 Apr 2014
3 answers
233 views
Hi,
Referring to the screencap http://upload.ximnet.com.my/huisheng/crop.png

Requirement: I want to let user crop a 300x300 thumbnail:

1. I have locked the width and height and hide the aspect ratio using JavaScript:

//This code sets the initial dimensions of the CropBox and the aspect ratio
       this._widthTxt.value = 300;
       this._heightTxt.value = 300;
       var ratio = 100 / 100; // (w/h)
       this._setCropBoxRatio(ratio);
       this._sizeRatio = ratio;
       this._updateCropBoxFromControls();


2. But if user drag the resize handler, they are still able to change the thumbnail size.
How do I lock the resize handler to prevent user from re-sizing when cropping?

3. What is the best way / correct way to load the thumbnail size from database?  Is it to use Ajax call in the ascx or there is a better method?

Thanks.

Vessy
Telerik team
 answered on 17 Apr 2014
4 answers
129 views
Is there any way to hide the pager control in a rad pivot grid.  I see that it is possible in normal grid but I am not sure how to do this in a pivot grid.

Thanks
Kalyani
Top achievements
Rank 1
 answered on 17 Apr 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?