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

I have a Grid now that is updated once a day with changes on various status' from my users. My question is, does anyone have any ideas on how to save those previous entries to an archive that the user can go into and view previous entries?

The goal would be to have this archive and then after a certain point those archived entries would be deleted to avoid taking up too much database room unnecessarily.

Right now here is how I am saving my grid to my database, I just wasn't sure on how to expand on this to get that additional functionality.

private void SaveDataInDataTable()
{
    foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
    {
        if (item.IsInEditMode)
        {
            int rowID = (int)item.GetDataKeyValue("ID");
            for (int i = 2; i < RadGrid1.MasterTableView.RenderColumns.Length; i++)
            {
                GridColumn column = RadGrid1.MasterTableView.RenderColumns[i];
                DataRow myDataRow = GridSource.Select("ID = " + rowID)[0];
                object value = GetColumnValue(column, item);
             
                if (column.DataType == typeof(int))
                {
                    if (value == string.Empty || value == null)
                    {
                        myDataRow[column.UniqueName] = DBNull.Value;
                    }
                    else
                    {
                        int parsedValue;
                        if (int.TryParse(value.ToString(), out parsedValue))
                        {  
                            myDataRow[column.UniqueName] = parsedValue;
                        }
                        else
                        {
                            myDataRow[column.UniqueName] = myDataRow[column.UniqueName];
                            RadAjaxManager1.Alert(string.Format("Value {0} is not valid for column {1}, row {2}. The old value was used!", value, column.UniqueName, item.ItemIndex+1));
                        }
                    }
                }
                else if (value == null)
                {
                    myDataRow[column.UniqueName] = DBNull.Value;
                }
                else if ((GridSource.Columns[column.UniqueName].MaxLength < value.ToString().Length) && GridSource.Columns[column.UniqueName].MaxLength != -1)
                {
                    myDataRow[column.UniqueName] = value.ToString().Substring(0, 5);
                }
                else
                {
                    myDataRow[column.UniqueName] = GetColumnValue(column, item);
                }
            }
        }
Radoslav
Telerik team
 answered on 17 Dec 2013
1 answer
83 views
Hi,

I am using Telerik RadScheduler version 2012.3.1016.40.

My client wants feature of creating appointments by selecting multiple timeslots in TimeLineView. But so far I am unable to find any such demo or examples in Forum too. Though demo exists for Day view, month view but not for TimeLine view.

Can you please share with me possible solution by any means ?
Plamen
Telerik team
 answered on 17 Dec 2013
6 answers
317 views
Hi,
i am using rad treeview,so how can i Disable parent node(dynamic) click in radtreeview.
Thanks
Nencho
Telerik team
 answered on 17 Dec 2013
0 answers
117 views
  Hello my my services account with bright cable has been encoded and has blocked my access and they have not beeb able to fix it. the encryption looks familiar    and the promram I used said it was manually put in. they used this to get all my voice mails sent to them via text thru Cincinnati Bell Telephone Services I live in New Port Richey Floria any help would be grateful please every thing has been tried blocking him is the most important thing  at this point thing.

�� `I�%&/m�{J�J��t��`$ؐ@�������iG#)�*��eVe]f@���{����{����;�N'���?\fdl��J�ɞ!���?~|?"��Ey�')=��y6�����h�����O��6����Η�<]Vm��m�Vi�L�e�f��:ǟ�?�+/{К�: T���Wv<[����~2�g�2���?�ʋ�y�hYՋ����� ��t� _N���M�l�������{��,���Xn���Q�}��������*g�������7�� ~�`�j'u>K�{_��IW�2����������,KO�eS��יy�/����m^+E eB��c*�j�w��,�Vu���q�2? @]�uC_��X_�����E^���d�Tm[-��;�w�v�V�r�MJY��y���uYP���2�����uC� ԡO��w}V|W�J�d��\0��>��m���ւh�����=z��4���GV,ӏ���D�������x*)=~<�ӫb��?�����S��g���gMQ���w b����Q����r^a�{�q�A  ��l���q]d�(�vNȴ��(�<_�����z�:[6ۯ��u�գ��_M^�i�:���i�L�b%������x�������"7������4APf��X^��<�o��Z�=�� �y�Oh��h�7�8}Y�Y��ߗE~�͈ӷi[`5tQhs��&պ�.x���j��U�VuA\���
�#w[��qp4O��ؠO����mV�� ��u�����uY�2�g�>J������Z�
ԜY��ƹe���2����3�br�7����!���w %w��$�3�s֦�f5S��M�O���$Ѥ����GWUQʔ�����&�&-}S���  ��t%�r^�euE�r�Z�����U
��`��W��?2���dzY��������)z���׹��
Ί�&����L^&�bz9/��P� ��7ق0�]��p9iV��o����g�2������bM�|&}����-��J��/�h P0���w��˜1E y �'J� �/ϋ��(] .͜V� �e���:�Q#2A���п�f^��E��q����`8/V����(Vi��|YӐ %q��8-��@��>�Ƥ{�
O<�zJ�03N V�����Ȭ���5�2�&�f0g�UU�b!s�j�\�<Ԛ��tV��h��O9i��f�ʺ����8�}�5t]��E���u]+Ͳp����.���h �3��j{�����KϪfk��fJ]6U"nLѧ]E���"+W1o`c_[8|53��^_��67ŌL19 ���6h�f=����Z�����_d$U�����_����
m
�oS$��|����R�����_�ࢶuU���E�J��|��N�����]��w�������2V�����pΨ�z���^���(=;!= n��P���� q! rqA.�7=�� ���,?��e�����O��������kl?�]��{���.�R(�8

 

Lavadia
Top achievements
Rank 1
 asked on 17 Dec 2013
1 answer
137 views
Hi,
I have a grid with a nested view. In my nested view I have to load a map.
How can I load a script on row expanded? Client or server side.
Is there a clientevents that I can use?

Script to load
//carico la mappa
         function LoadMap(lat, lon) {
             if (lat == "0")
                 return;
 
             var myLatLng = new google.maps.LatLng(lat, lon);
  
             var mapOptions = {
                 zoom: 2,
                 center: myLatLng,
                 mapTypeId: google.maps.MapTypeId.HYBRID
             }
  
             map = new google.maps.Map(document.getElementById("map"), mapOptions);
             infowindow = new google.maps.InfoWindow();
             createMarker(new google.maps.LatLng(lat, lon), "testo interno", "");
         }


       protected void HomeRadGrid_ItemCommand(object sender, GridCommandEventArgs e)
       {
           switch (e.CommandName)
           {          
               case "ExpandCollapse":                   
                       //LOAD SCRIPT
                       break;
           }
       }

Thanks
Radoslav
Telerik team
 answered on 17 Dec 2013
1 answer
88 views
Hi


I need to sum on column in footer of grid. But it depends on condition

suppose i want A colum sum in fotter, Depnd on B column value if B column row value is null then no need consider that row 

    Column A  Colum B
            12                  30
            22                  
            44                   40
Sum :   56

only consider first and last row.
in sendon row b column is null

please help
Eyup
Telerik team
 answered on 17 Dec 2013
1 answer
115 views
I have an app where the user selects a From Date/Time and a To Date/Time. The default time on the End needs to be 23:59. Consider that if the user selects the same date in both controls that they intend to mean the entire day, not 12am to 12am of the same day. And it's a bit much to ask them to select the next day so that they get 12am of the next day.

So we're looking for a default of:
From 12/12/2013 00:00 to 12/12/2013 23:59

How do I set that? For the RadDateTimePicker, if I use markup to set the DateInput SelectedDate to "23:59", assuming the current date will get substituted, it still defaults to current date 00:00. Anything I set there is not used, like SelectedDate="01/01/2014 06:00AM". I know the default value for DateInput is MinDate, but I don't want to set a MinDate of "from date 23:59" because that will preclude setting to an earlier time of day.

Also, assume the user selects 21:00 but then they really want to change it to "end of day". Do I need to create a custom list in the TimeView which will allow them to select various times, including a final 23:59?

Rather than trying to accommodate such nuances, I'm wondering if there is a better solution. For example, I can code some post-processing logic that says "if the start and end-time are both 00:00 of the same day, then make the To time 23:59" for subsequent queries, or we can simply not use the time component if the date and tie are the same and the time is 00:00.

Thanks for your consideration. And I hope this help someone else who is working out a From/To scenario.
TonyG
Top achievements
Rank 1
 answered on 17 Dec 2013
3 answers
177 views
Greetings,

I'll try to be clear as possible in describing this problem as I couldn't catch its cause until I did long debugging inside Rad controls' code.

What I'm trying to create is a serial column (1, 2, 3, …) that keeps its proper serialing with the user deleting from and adding to the grid in batch mode.
The logic is very simple. I added a handler to the RowCreated event as follows:

grid.add_rowCreated(function (sender, args)
    {
        var item = args.get_item();
 
        if(Edge.UI.GridExtensions.isNewRow(item))
            Edge.UI.GridExtensions.setCellValue(item, uniqueName, Edge.UI.GridExtensions.SerialColumn.getMaxSerialValue(tableView, uniqueName) + 1);
    });
 
Edge.UI.GridExtensions.SerialColumn.getMaxSerialValue = function (tableView, uniqueName)
{
    var max = Number.NEGATIVE_INFINITY,
        dataItems = tableView.get_dataItems();
 
    if(dataItems && dataItems.length)
    {
        for(var i = dataItems.length; i--;)
        {
            var value = parseInt(Edge.UI.GridExtensions.getCellValue(dataItems[i], uniqueName));
 
            if(value > max)
                max = value;
        }
    }
 
    return max === Number.NEGATIVE_INFINITY ? 0 : max;
}

The relevant part is the line marked with bold and italic (dataItems = tableView.get_dataItems())

Here's the sequence I do to reproduce the problem:
  1. I start with an empty grid, then click the "Add New" button.
  2. The button calls BatchEditingManager.addNewRecord which in turn calls GridTableView.createItem.
  3. createItem creates the TR element and appends it to the DOM and creates a GridDataItem object for it.
  4. Then, near the end of the method body, come two lines of code who cause the problem:
    p._owner.raise_rowCreated(new Telerik.Web.UI.GridDataItemEventArgs(n, null));
    Array.insert(e, k, d);
    I extracted these from the minified code with the usage of chrome developer tools' pretty print feature. You may find them using the find functionality of your text editor. The first line calls my event handler, which calls get_dataItems (the line in bold in the first code block). Inside get_dataItems the code checks the length of the internal _dataItems array:
    if (this._dataItems.length > 0 || (this._cachedItems && this._cachedItems.length > 0)) {
                return this._dataItems;
            }
    Of course it finds the length equal to zero because the GridDataItem object wasn't added to the array yet in createItem. The code then goes into initialising the _dataItems array from the TR elements:
    var o = ($telerik.isOpera) ? this.get_element() : this.get_element().tBodies[0];
            var n = o.rows;
            for (var c = 0, k = n.length;
            c < k;
            c++) {
                
                this._owner.raise_rowCreating(new Sys.EventArgs());
                
                if (!b) {
                    b = $create(Telerik.Web.UI.GridDataItem, {_owner: this,_data: a}, null, null, m);
                }
               
                this._dataItems[this._dataItems.length] = b;
                this._owner.raise_rowCreated(new Telerik.Web.UI.GridDataItemEventArgs(m, null));
            }
    I replaced the irrelevant parts with ellipsis. This code adds a GridDataItem object to the array then raises the RowCreated event (which is the proper behaviour), but I wonder why isn't the event raised inside the if(!b) block? If the b object exists from a previous initialisation, why raising the RowCreated event for it again? The last piece of code causes my event handler to be called again and my serial result to be wrongly evaluated (it returns 2 instead of one), but this is not the main problem.
  5. After all that code executes, the _dataItems array now have two objects for the same TR element (one created by createItem and the other created by the get_dataItems accessor), if I remove the single grid row using BatchEditingManager.deleteRecord the grid remains with an orphan GridDataItem object.

After this, the grid stops working. When I try adding new lines, an exception erupts. I don't know certainly the cause, but it should be because of the orphan item.

After the description of the problem, I'd like to say that some accessors in the Rad controls code involve a lot of work which shouldn't be the nature of accessors. I have some places where get_dataItems raises exceptions, and I had no means to avoid but a nasty dummy try/catch

try
    {
        gridDataItems = this.tableView.get_dataItems();
    } catch(dummy)
    { }

أشرف
Top achievements
Rank 1
 answered on 17 Dec 2013
1 answer
123 views

Hi, I have this RadGrid whose data can be edited; the problem is that when moving between pages the data is lost because NeedDataSource event is triggered if the user doesn't click on an OK button, the data is not saved.

This is the grid definition:
 <telerik:RadGrid ID="Grilla" runat="server" Height="570px" OnNeedDataSource="LeeDatos"
                PageSize="20"  SkinID="Grilla2" Width="775px" GridLines="None"   ClipCellContentOnResize="true"
                TableLayout="Auto">
(etc)

So I changed PageSize to "9999" but now the grid is displayed all in a single page but when I click on Ok I have this message:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500

(seems to happen with a PageSize greater then 190, according to tests).

No matter if I click on Ok or Cancel buttons (in a Telerik.Web.UI.RadToolBar), the same error is thrown.

Any hint?

Thanks
Princy
Top achievements
Rank 2
 answered on 17 Dec 2013
1 answer
48 views
I see the demo can do Dates on the header. However, we need it to show 1 single day with the times running from left to right in the header. Is the screenshot attached possible?
Shinu
Top achievements
Rank 2
 answered on 17 Dec 2013
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?