Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
258 views
Hi,

I am using RadGrid with Grid persistence classes to maintain Grid settings in a session even after page refreshes.(refer link below).

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/savinggridsettingsonperuserbasis/defaultcs.aspx

Now, I am seeing that Grid persister is not working properly when I am Hiding/Showing Grid columns from Client side.
I am using below C# code on Page load event to maintain Grid Settings.

if (Page.IsPostBack)

            {

                GridSettingsPersister SavePersister = new GridSettingsPersister(this.radGridItem);

                Session["GridSetting"] = SavePersister.SaveSettings();

            }

//Loading the Grid control with the saved persistence setting

            if (Session["GridSetting"] != null)

            {

                GridSettingsPersister LoadPersister = new GridSettingsPersister(this.radGridItem);

                string settings = (string)Session["GridSetting"];

                LoadPersister.LoadSettings(settings);

            }

Below are my grid settings:
<telerik:radgrid id="radGridItem" allowpaging="True" runat="server" allowmultirowselection="true"

 

 

 

autogeneratecolumns="False" pagesize="20" allowsorting="True" gridlines="Horizontal"

 

 

 

 

onitemcommand="RadGridItem_ItemCommand" onitemdatabound="RadGridItem_ItemDataBound"

 

 

 

 

onneeddatasource="RadGridItem_NeedDataSource" onprerender="RadGridItem_PreRender">

 

 

 

 

<pagerstyle mode="NextPrevAndNumeric" position="Bottom" alwaysvisible="true" pagesizelabeltext="Size:"

 

 

 

 

showpagertext="True" />

 

 

 

 

<mastertableview tablelayout="Fixed" width="100%" canretrievealldata="false" autogeneratecolumns="False"

 

 

 

 

retrievealldatafields="false" allowmulticolumnsorting="false">

 

 

 

 

<Columns>

 

 

 

 

</Columns>

 

 

 

 

 

</mastertableview>

 

 

 

 

<clientsettings>

 

 

 

 

<Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />

 

 

 

 

<ClientEvents OnGridCreated="gridCreated" />

 

 

 

 

<Resizing AllowColumnResize="true" ClipCellContentOnResize="false" ResizeGridOnColumnResize="false"

 

 

 

 

EnableRealTimeResize="true" />

 

 

 

 

</clientsettings>

 

 

 

 

<groupingsettings casesensitive="false" />

 

 

 

 

</telerik:radgrid>

 

 

 

 

 

Please let me know if require any other details from my side.

Thanks in advance
Gaurav Jain

Mohammed
Top achievements
Rank 2
 answered on 25 Oct 2012
1 answer
84 views
Hi,
 How do i set tooltip on Clear button for clear?

Thanks.
Kate
Telerik team
 answered on 25 Oct 2012
1 answer
163 views
Hi

I'm using rad grid and implemented parameters for insert,update and where.
But created parameters for update not updated the database. Insert and where parameters are working perfectly.

Please look at the code how I implemented in the project,

<asp:LinqDataSource ID="ldsDList" runat="server" <br>                        ContextTypeName="MDataContext" <br>                        EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeName="" <br>                        TableName="DLists"><br>                        <InsertParameters><br>                            <asp:ControlParameter ControlID="HFUser" Name="EnteredBy" <br>                            PropertyName="Value" Type="Int32" /><br>                            <asp:Parameter Name="DateEntered" Type="DateTime" /><br>                        </InsertParameters><br>                        <UpdateParameters><br>                            <asp:ControlParameter ControlID="HFUser" Name="ModifiedBy" <br>                            PropertyName="Value" Type="Int32" DbType="Int32" /><br>                            <asp:Parameter Name="DateModified" Type="DateTime" /><br>                        </UpdateParameters><br>                    </asp:LinqDataSource>



Protected Sub ldsDList_ContextCreating(sender As Object, e As System.Web.UI.WebControls.LinqDataSourceContextEventArgs) Handles ldsDList.ContextCreating<br>        If e.Operation = DataSourceOperation.Insert Then<br>            Me.ldsDList.InsertParameters("DateEntered").DefaultValue = DateTime.Now.ToString()<br>        ElseIf e.Operation = DataSourceOperation.Update Then<br>            Me.ldsDList.UpdateParameters("DateModified").DefaultValue = DateTime.Now.ToString()<br>        End If<br>    End Sub
Angel Petrov
Telerik team
 answered on 25 Oct 2012
2 answers
110 views
hi, I'm new in telerik so maybe this question is trivial.

anyway, i want to know if the checkbox element in the data item in the grid is eanble, and if so then i want to do something.

    if (args.get_gridDataItem().get_selected(). get_checkboxelement() .Enabled == true)
        args.get_gridDataItem().set_selected(!args.get_gridDataItem().get_selected()); // or something

this the code. what i need to do to make it work?



Shir
Top achievements
Rank 1
 answered on 25 Oct 2012
1 answer
63 views
Hi members,
i am still new in testing telerik great controls and one of my favourites is the RibbonBar-Control.
I can follow the example "Find the RadComboBox server sde" at http://www.telerik.com/help/aspnet-ajax/ribbonbar-templates-accessing-controls-server-side.html, but dont know, how to access controls, when they are
a) in a RibbonBarContextualTabGroup
or
b) in a RibbonBarControlGroup

The solution (as described in the upper link) with:
Dim tab2 As RibbonBarTab = RadRibbonBar1.FindTabByValue("Tab2")
Dim combobox1 As RadComboBox = DirectCast(tab2.Groups(0).Items(0).FindControl("RadComboBox1"), RadComboBox)

doesn't work, when the control is in a RibbonBarContextualTabGroup or RibbonBarControlGroup.

Thanks for any help!!!
Michael

Kate
Telerik team
 answered on 25 Oct 2012
1 answer
60 views
Hi,

I have two related combobox controls . The second combobox (disabled by default) becomes enabled by selecting an item in the first combobox.
By selecting an item in the first control, the sencond one become enabled and a TEXT is added to the URL (View attached screen-shot). What is that? and how can I hide it (always). I mean, I don't need that the URL be affected by the web controls.

Regards,
Bader
Kalina
Telerik team
 answered on 25 Oct 2012
1 answer
146 views
Hi, 

we have a Grid with a couple of GridNumericColumns.
We want to load all rows in this Grid in edit mode when the page loads.

With about 50 items in the grid, the page loads relatively fast without about 1 seconds of Javascript execution measured in the Internet Explorer Developer Toolbar.

With 150 items there is noticeable lag in the browser after the items are displayed. Dev Toolbar profiler registers about 6 seconds of Javascript execution.

Wotj 250 items loaded the browser hangs on load, we get a long loading Javascript warning from Internet Explorer, and the profiler shows about 20 seconds of Javascript execution.

When removing the GridNumericColumns and replacing them with regular GridBoundColumns the rendering is blazing fast again (Profiler registers < 50ms of Javascript exeuction).

Here is sample code for you to reproduce the issue:
<telerik:RadScriptManager runat="server" ID="sm1">
       </telerik:RadScriptManager>
        
       <telerik:RadTextBox ID="itemcount" Label="ItemCount" runat="server"></telerik:RadTextBox>
       <asp:Button runat="server" OnClick="OnClick" Text="Reload"/>
        
       <telerik:RadGrid ID="grid" runat="server" Width="990px" EnableLinqExpressions="False"
           CellSpacing="0" DataSourceID="ObjectDataSource2" GridLines="None" OnPreRender="grid_OnPreRender" AllowMultiRowEdit="True">
           <FilterMenu EnableImageSprites="False">
           </FilterMenu>
           <MasterTableView AutoGenerateColumns="False" DataSourceID="ObjectDataSource2" AllowSorting="True" EditMode="InPlace">
               <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
               <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
               </RowIndicatorColumn>
               <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
               </ExpandCollapseColumn>
               <Columns>
                   <telerik:GridNumericColumn DataField="Value1" FilterControlAltText="Filter Value1 column"
                       HeaderText="Value1" SortExpression="Value1" UniqueName="Value1" runat="server">
                   </telerik:GridNumericColumn>
                   <telerik:GridNumericColumn DataField="Value2" FilterControlAltText="Filter Value2 column"
                       HeaderText="Value2" SortExpression="Value2" UniqueName="Value2" runat="server">
                   </telerik:GridNumericColumn>
                   <telerik:GridNumericColumn DataField="Value3" FilterControlAltText="Filter Value2 column"
                       HeaderText="Value3" SortExpression="Value3" UniqueName="Value3" runat="server">
                   </telerik:GridNumericColumn>
                   <telerik:GridNumericColumn DataField="Value4" FilterControlAltText="Filter Value2 column"
                       HeaderText="Value4" SortExpression="Value4" UniqueName="Value4" runat="server">
                   </telerik:GridNumericColumn>
               </Columns>
               <EditFormSettings>
                   <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                   </EditColumn>
               </EditFormSettings>
           </MasterTableView>
       </telerik:RadGrid>
       <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetObjects"
           TypeName="SimpleObjectProvider">
           <SelectParameters>
               <asp:ControlParameter runat="server" ControlID="itemcount" Type="Int32" Name="itemcount"/>
           </SelectParameters>
       </asp:ObjectDataSource>


 
protected void grid_OnPreRender(object sender, EventArgs e)
    {
        foreach (GridItem item in grid.Items)
        {
            item.Edit = true;
        }
 
        grid.Rebind();
    }
 
    protected void OnClick(object sender, EventArgs e)
    {
        grid.Rebind();
    }

public class SimpleObjectProvider
{
    public int itemcount = 100;
 
    /// <summary>
    /// Initializes a new instance of the <see cref="SimpleObjectProvider"/> class.
    /// </summary>
    public SimpleObjectProvider()
    {
    }
 
    /// <summary>
    /// Simple Select Method
    /// </summary>
    /// <returns>List of Objects</returns>
    public List<SimpleObject> GetObjects(int itemcount)
    {
        var simpleObjects = new List<SimpleObject>();
 
        for (int i = 1; i <= itemcount; i++)
        {
            simpleObjects.Add(new SimpleObject(i, i * i, 1m / i, 1.4m * i));
        }
 
        return simpleObjects;
    }
}
 
/// <summary>
/// A simple object
/// </summary>
public class SimpleObject
{
 
    public SimpleObject(decimal value1, decimal value2, decimal value3, decimal value4)
    {
        Value1 = value1;
        Value2 = value2;
        Value3 = value3;
        Value4 = value4;
    }
 
    public decimal Value4 { get; set; }
 
    public decimal Value3 { get; set; }
 
    public decimal Value1 { get; set; }
 
    public decimal Value2 { get; set; }
}


Vasil
Telerik team
 answered on 25 Oct 2012
4 answers
160 views

Hi,

I am trying to implement the load on demand functionality in Org Chart control.
From what I understand from the link1 and link2 is that the whole data (including the data which has already been rendered) needs to be rebound to the control each time a node is expanded. Please correct me if my understanding is wrong. If not, is it possible to implement it in such a way that if a node is expanded, only the children of that node needs to be fetched and bound to the control.
My primary objective is to bind a huge data set to the orgchart control without affecting the performance.
Thanks!

Peter Filipov
Telerik team
 answered on 25 Oct 2012
1 answer
209 views
Hi,

I'm using RadAsyncUpload on my page for uploading photos.I have multiple areas on the same page.It's configured like this:

<div class="photocontainer"><span class="message">
       <ecadis:EcadisLabel ID="lblLeftPhotoView" LabelId="text.leftPhotoView"
        runat="server" />
        <ecadis:EcadisLabel runat="server" ID="lblLeftPhotoViewRequired" LabelId="text.requiredStar" Visible="False"  CssClass="error"/></span>
                    <telerik:RadBinaryImage runat="server" Width="175px" Height="120px" ResizeMode="Crop" ID="leftViewPhoto" SavedImageName="linkerflank.png" ImageUrl="/images/linkerflank.png"/>
                    <span class="invalidLeftPhoto"></span>
                    <telerik:RadAsyncUpload runat="server"
                                            ID="leftPhotoViewAsyncUpload"
                                            MaxFileInputsCount="1"
                                            MaxFileSize="2411724"
                                            OnClientFileUploaded="onLeftPhotoUploaded"
                                            OnFileUploaded="LeftViewPhotoFileUploaded"
                                            AllowedFileExtensions="jpeg,jpg,gif,png,bmp"
                                            OnClientValidationFailed="onLeftPhotoValidationFailed" >
                    </telerik:RadAsyncUpload>
                    <telerik:RadButton runat="server" ID="btnResetLeftPhotoView" AutoPostBack="false" OnClientClicked="leftViewPhotoClearImage">
                    </telerik:RadButton>
                </div>
 
                <div class="photocontainer"><span class="message">
       <ecadis:EcadisLabel ID="lblRightPhotoView" LabelId="text.rightPhotoView" runat="server"/><ecadis:EcadisLabel runat="server" ID="lblRightPhotoViewRequired" LabelId="text.requiredStar" Visible="False" CssClass="error"/></span>
                    <telerik:RadBinaryImage runat="server" Width="175px" Height="120px" ResizeMode="Crop" ID="rightViewPhoto" SavedImageName="rechterflank.png" ImageUrl="/images/rechterflank.png"/>
                    <span class="invalidRightPhoto"></span>
                    <telerik:RadAsyncUpload runat="server"
                                            ID="rightPhotoViewAsyncUpload"
                                            MaxFileInputsCount="1"
                                            MaxFileSize="2411724"
                                            OnClientFileUploaded="onRightPhotoUploaded"
                                            OnFileUploaded="RightViewPhotoFileUploaded"
                                            AllowedFileExtensions="jpeg,jpg,gif,png,bmp"
                                            OnClientValidationFailed="onRightPhotoValidationFailed">
                    </telerik:RadAsyncUpload>
                    <telerik:RadButton runat="server" ID="btnResetRightViewPhoto" AutoPostBack="False" OnClientClicked="rightViewPhotoClearImage" />
                </div>
            </div>
     
            <div class="dragAndDrop WP100">
                <div class="photocontainer"><span class="message">
      <ecadis:EcadisLabel runat="server" ID="lblFrontalPhotoView" LabelId="text.frontalPhotoView"/><ecadis:EcadisLabel runat="server" ID="lblFrontalPhotoViewRequired" LabelId="text.requiredStar" Visible="False" CssClass="error"/></span>
                    <telerik:RadBinaryImage runat="server" Width="175px" Height="120px" ResizeMode="Crop" ID="frontalViewPhoto" SavedImageName="frontaal.png" ImageUrl="/images/frontaal.png"/>
                    <span class="invalidFrontal"></span>
                    <telerik:RadAsyncUpload runat="server"
                                            ID="frontaalPhotoViewAsyncUpload"
                                            MaxFileInputsCount="1"
                                            MaxFileSize="2411724"
                                            OnClientFileUploaded="onFrontalPhotoUploaded"
                                            OnFileUploaded="FrontaalPhotoFileUploaded"
                                            AllowedFileExtensions="jpeg,jpg,gif,png,bmp"
                                            OnClientValidationFailed="onFrontalPhotoValidationFailed">
                    </telerik:RadAsyncUpload>
                    <telerik:RadButton runat="server" ID="btnResetFrontaalViewPhoto" AutoPostBack="False" OnClientClicked="frontaalViewPhotoClearImage"></telerik:RadButton>
                </div>
         
                <div class="photocontainer"><span class="message"><ecadis:EcadisLabel ID="EcadisLabel5" LabelId="text.backPhotoView" runat="server"/><ecadis:EcadisLabel runat="server" ID="lblBackPhotoViewRequired" LabelId="text.requiredStar" Visible="False" CssClass="error"/></span>
                    <telerik:RadBinaryImage runat="server" Width="175px" Height="120px" ResizeMode="Crop" ID="backViewPhoto" SavedImageName="achteraan.png" ImageUrl="/images/achteraan.png" />
                    <span class="invalidBack"></span>
                    <telerik:RadAsyncUpload runat="server"
                                            ID="backPhotoViewAsyncUpload"
                                            MaxFileInputsCount="1"
                                            OnClientFileUploaded="onBackPhotoUploaded"
                                            OnFileUploaded="BackPhotoFileUploaded"
                                            AllowedFileExtensions="jpeg,jpg,gif,png,bmp"
                                            OnClientValidationFailed="onBackPhotoValidationFailed"
                                            MaxFileSize="2411724">
                    </telerik:RadAsyncUpload>
                    <telerik:RadButton runat="server" ID="btnResetBackViewPhoto" AutoPostBack="False" OnClientClicked="backViewPhotoClearImage"></telerik:RadButton>
                </div>
            </div>
     
            <div class="dragAndDrop WP100">
                <div class="photocontainer"><span class="message"><ecadis:EcadisLabel ID="EcadisLabel6" LabelId="text.intFrontPhotoView" runat="server"/><ecadis:EcadisLabel runat="server" ID="lblIntFrontPhotoRequired" LabelId="text.requiredStar" Visible="False" CssClass="error"/></span>
                    <telerik:RadBinaryImage runat="server" Width="175px" Height="120px" ResizeMode="Crop" ID="interiourFrontViewPhoto" SavedImageName="interieur_vooraan.png" ImageUrl="/images/interieur_vooraan.png" />
                    <span class="invalidIntFront"></span>
                    <telerik:RadAsyncUpload runat="server"
                                            ID="interiourFrontViewAsyncUpload"
                                            MaxFileInputsCount="1"
                                            OnClientFileUploaded="onIntFrontPhotoUploaded"
                                            OnFileUploaded="InteriourFrontPhotoFileUploaded"
                                            AllowedFileExtensions="jpeg,jpg,gif,png,bmp"
                                            OnClientValidationFailed="onIntFrontPhotoValidationFailed"
                                            MaxFileSize="2411724"></telerik:RadAsyncUpload>
                    <telerik:RadButton runat="server" ID="btnResetInteriourFrontViewPhoto" AutoPostBack="False" OnClientClicked="interiourFrontViewPhotoClearImage"></telerik:RadButton>
                </div>

On the client side I have the following Javascript:
function onLeftPhotoUploaded(sender, args) {
                       $find("<%=radAjaxManager.ClientID %>").ajaxRequest();
                       $telerik.$(".invalidLeftPhoto").html("");
                       $telerik.$("#lblLeftPhotoViewRequired").html("");
                       setTimeout(function () {                        
                           sender.deleteFileInputAt(0);                        
                       }, 10);
                   }
                   function onLeftPhotoValidationFailed(sender, args) {
                       $telerik.$('.invalidLeftPhoto').html('<%= MasterController.GetLabelValue("text.fileTooBig") %>').addClass("error");
                       sender.deleteFileInputAt(0);
                   }
                   function onRightPhotoUploaded(sender, args) {                      
                       $find("<%=radAjaxManager.ClientID %>").ajaxRequest();
                       $telerik.$(".invalidRightPhoto").html("");
                       $telerik.$("#lblRightPhotoViewRequired").html("");
                       setTimeout(function () {
                           console.log(sender._uploadedFiles.length);
                           sender.deleteFileInputAt(0);                          
                       }, 10);
                   }
                   function onRightPhotoValidationFailed(sender, args) {
                       $telerik.$('.invalidRightPhoto').html('<%= MasterController.GetLabelValue("text.fileTooBig") %>').addClass("error");
                       sender.deleteFileInputAt(0);
                   }


On the server side I have the following code:

protected void LeftViewPhotoFileUploaded(object sender, FileUploadedEventArgs e)
   {           
       string path = Path.Combine(ConfigurationManager.AppSettings["SaveLocation"], PartnerId.ToString(), CarId.ToString(), ConfigurationManager.AppSettings["GeneralPictureLocation"]);
       e.File.SaveAs(Path.Combine(path, "linkerflank.png"));      
       byte[] array = CreateThumbnail(path, "linkerflank.png");        
       leftViewPhoto.DataValue = array;
   }
 
   protected void RightViewPhotoFileUploaded(object sender, FileUploadedEventArgs e)
   {           
       string path = Path.Combine(ConfigurationManager.AppSettings["SaveLocation"], PartnerId.ToString(), CarId.ToString(), ConfigurationManager.AppSettings["GeneralPictureLocation"]);
       e.File.SaveAs(Path.Combine(path, "rechterflank.png"));
       byte[] array = CreateThumbnail(path, "rechterflank.png");
       rightViewPhoto.DataValue = array;
   }

The problem is that when I delete an existing photo from an area, and then upload another photo to another area , the "old" photo is also rendered.I suppose that I can fix this with some cache settings on to the control.Can you help me with this bug?

Thank you.
Peter Filipov
Telerik team
 answered on 25 Oct 2012
3 answers
239 views
I have some appointments and displaying in scheduler control. If the subject text is only two words its fine since it displays in one line but if the subject is long it goes to second line or third line but I can see only the first line. I want to expand the background rectangle as it expands the subject.
Boyan Dimitrov
Telerik team
 answered on 25 Oct 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?