Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
2.1K+ views
I'm hoping there is a simple fix for this, but I would accept a complicated one after messing around with it for the last week!

I am putting together a module that will drop into a DotNetNuke portal and I'm populating a Telerik RadGrid with data. I have followed every tutorial and example I can find, but the result keeps coming back with "object Object", "null", or "undefined" when I try to get the value of a cell in the selected rows.

I need to:
1) get the value of the "BookingID'" column for each row that is selected
2) pass the value into a url string that opens up in a RadWindow.

I'm trying to do all of this using javascript, but if you know a better way, I'm down for anything at this point.
Here are some of the tutorials and examples I have followed to no avail:

http://stackoverflow.com/questions/761633/select-a-radgrid-row-client-side-inside-radwindows
http://www.telerik.com/help/aspnet/grid/grdgettingcellvaluesforselectedrowsclientside.html
http://www.telerik.com/community/forums/aspnet-ajax/grid/extracting-cell-values-from-radgrid.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/client/selecting/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/client/keys/defaultcs.aspx

Here is my current JavaScript and a stripped down radGrid:

function gup(name) {  
        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");  
        var regexS = "[\\?&]" + name + "=([^&]*)";  
        var regex = new RegExp(regexS);  
        var results = regex.exec(window.location.href);  
        if (results == null) return "";  
        else return results[1];  
    }  
        function ShowEditForm() {  
            var tab = gup('tabid')  
            var mid = gup('mid').replace(/#/, '')  
            var masterTableView = $find("perDiemBookingsRadGrid").get_masterTableView();  
            var id = masterTableView.get_selectedItems()[0].getDataKeyValue('BookingID');  
 
            window.radopen("/Default.aspx?tabid=" + tab + "&ctl=multiEdit&mid=" + mid + &BIDs=" + id, "RadWindow3");  
        } 
<telerik:RadGrid ID="perDiemBookingsRadGrid" runat="server" AllowPaging="True" AllowSorting="True" 
           DataSourceID="perDiemBookingsSqlDataSource" GridLines="None" ShowGroupPanel="True" 
           AllowAutomaticDeletes="True" AllowMultiRowSelection="True" Width="800px" AllowAutomaticUpdates="True" 
           AutoGenerateColumns="False" >  
             <MasterTableView DataSourceID="perDiemBookingsSqlDataSource" DataKeyNames="BookingID" 
               CommandItemDisplay="Top">  
                 <CommandItemTemplate>  
                    <div style="padding: 5px 5px;">  
                      <a href="#" onclick="return ShowEditForm();" visible='<%# perDiemBookingsRadGrid.EditIndexes.Count = 0 %>'>  
                      <img style="border: 0px; vertical-align: middle;" alt="" src="/images/Edit.gif" />  
                      Show Edit Form</a> &nbsp;&nbsp;  
                    </div>  
                 </CommandItemTemplate>  
                 <Columns>  
                    <telerik:GridClientSelectColumn Reorderable="False" Resizable="False" ShowSortIcon="False" 
                    UniqueName="column">  
                    </telerik:GridClientSelectColumn>  
                    <telerik:GridBoundColumn DataField="BookingID" UniqueName="BookingID" DataType="System.Int32" 
                     HeaderText="BookingID" ReadOnly="True" SortExpression="BookingID" Visible="False">  
                    </telerik:GridBoundColumn>  
                    <telerik:GridTemplateColumn DataField="CustomerName" HeaderText="Customer" UniqueName="Customer" 
                     EditFormColumnIndex="2" GroupByExpression="GROUP BY CustomerName" SortExpression="CustomerName">  
                    <EditItemTemplate>  
                 </Columns>  
                      <EditFormSettings ColumnNumber="3">  
                          <EditColumn UniqueName="EditCommandColumn1">  
                          </EditColumn>  
                      </EditFormSettings>  
            </MasterTableView>  
            <ClientSettings AllowDragToGroup="True">  
                 <Selecting AllowRowSelect="True"/>  
            </ClientSettings>  
</telerik:RadGrid>  
 
Pavlina
Telerik team
 answered on 02 Jul 2014
1 answer
234 views
Hi,

Is there any way to disable multiple selection of time slots in the control please?

I only want the user to be able to select half hour slots and for them not to be able to extend it past the half hour slot?

Thanks for your help
Nencho
Telerik team
 answered on 02 Jul 2014
6 answers
198 views
Not a big deal, but wizard replaces Web.config with web.config (first letter capital -> small) which in turn causes SVN (at least TortoiseSVN) to act dumb.
Second thing, but I presume that this is a feature not a bug (although for me it's little annoying): Upgrade wizard replaces Telerik handlers in web.config entirely, so every upgrade I have to change from 
type="Telerik.Web.UI.WebResource"
to
type="Telerik.Web.UI.WebResourceSession".


It would be really nice if you could change that..

Jacek

										
Dustin
Top achievements
Rank 1
 answered on 02 Jul 2014
3 answers
89 views
Anybody can help me how to make dynamic  drag and drop between RadGrid? Let say I have 4 RadGrid and I want 1st RadGrid's row to 2nd RadGrid or 3rd RadGrid or 4th RadGrid. As reverse 2nd RadGrid row to 1st or 3rd or 4th RadGrid. I appreciate any reference or tutorial.

Thanks & Best Regards
HAN 
Maria Ilieva
Telerik team
 answered on 02 Jul 2014
1 answer
70 views
Can any body help me why does IE and FireFox cann't fire OnAjaxRequest. But Chrome can work properly . I want to publish my code

ASPX

  <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                <Scripts>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
                    <asp:ScriptReference Path="~/JavaScripts/lib/jquery-ui-1.10.4.min.js" />
                    <asp:ScriptReference Path="~/JavaScripts/lib/jquery.blockUI.min.js" />
                    <asp:ScriptReference Path="~/JavaScripts/lib/Json2.min.js" />
                </Scripts>
                <Services>
                    <asp:ServiceReference Path="~/Services/ReservationService.asmx" />
                </Services>
            </telerik:RadScriptManager>
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadAjaxManager1"/>
                            <telerik:AjaxUpdatedControl ControlID="grdBillingContact" />
                            <telerik:AjaxUpdatedControl ControlID="hdnChkEmptyRow" />
                            <telerik:AjaxUpdatedControl ControlID="grdTrans" />
                            <telerik:AjaxUpdatedControl ControlID="grdLedger1" />
                            <telerik:AjaxUpdatedControl ControlID="grdLedger2" />
                            <telerik:AjaxUpdatedControl ControlID="grdLedger3" />
                            <telerik:AjaxUpdatedControl ControlID="grdLedger4" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="grdBillingContact">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="grdBillingContact" />
                            <telerik:AjaxUpdatedControl ControlID="hdnChkEmptyRow" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>

                    <telerik:AjaxSetting AjaxControlID="grdTrans">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="grdTrans" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="RadTabStrip1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="grdBillingContact" />
                            <telerik:AjaxUpdatedControl ControlID="hdnChkEmptyRow" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
                <ClientEvents OnRequestStart ="RequestStart" OnResponseEnd="ResponseEnd" />
            </telerik:RadAjaxManager>


  function onRowDropping(sender, args) {
                    var draggedItems = args.get_draggedItems();
                    var rateKey = null;
                    if (draggedItems.length === 1) {
                        rateKey = draggedItems[0].getDataKeyValue('ReservationRateKey');
                    }
                    var destinationHtmlElement = args.get_destinationHtmlElement();
                    var sender_id = sender.get_id();
                    switch (sender_id) {
                        case 'grdLedger1': {
                            if (isChildOf('<%=grdLedger2.ClientID %>', destinationHtmlElement)) {
                                if (rateKey !== null) {
                                    var cmd = 'UpdateLedger|' + rateKey + '|2';
                                    AjaxRequest(cmd);
                                }
                            }
                            else if (isChildOf('<%=grdLedger3.ClientID %>', destinationHtmlElement)) {
                                    if (rateKey !== null) {
                                        var cmd = 'UpdateLedger|' + rateKey + '|3';
                                        AjaxRequest(cmd);
                                    }
                                }
                                else if (isChildOf('<%=grdLedger4.ClientID %>', destinationHtmlElement)) {
                                    if (rateKey !== null) {
                                        var cmd = 'UpdateLedger|' + rateKey + '|4';
                                        AjaxRequest(cmd);
                                    }
                                }
                                else {
                                    args.set_cancel(true);
                                }
                        }
break;
}
}
 function isChildOf(parentId, element) {
                    while (element) {
                        if (element.id && element.id.indexOf(parentId) > -1) {
                            return true;
                        }
                        element = element.parentNode;
                    }
                    return false;
                }


 function AjaxRequest(command) {
                     var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
                    ajaxManager.ajaxRequest(command);
                }

.CS


 protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
       // base.RaisePostBackEvent(source, eventArgument);
        string eventArgument = e.Argument;
        if (eventArgument != null)
        {
             if (eventArgument.StartsWith("UpdateLedger|")) 
            {
                string[] strs = eventArgument.Split('|');
                if(strs.Length == 3)
                {
                    Guid? rateKey = Others.GetGuid(strs[1]);
                    int? ledger = Others.GetIntFromString(strs[2]);
                    if (rateKey.HasValue && ledger.HasValue)
                    {
                        bool updated = HMSModel.BLL.ReservationRateDB.UpdateReservationRateLedger(rateKey.Value, ledger.Value, ConnectionManager.CreateConnection(true));
                        if(updated)
                        {
                            this.LoadAllData(); // Reload all the data before rebind
                            BindLedgerList();
                        }
                    }
                }
            }
        }
    }
Maria Ilieva
Telerik team
 answered on 02 Jul 2014
4 answers
207 views
Hi,

I am trying to bind a simple RadListView using a WebService (ASMX).

Here is my code:
<telerik:RadListView runat="server" ID="lvTest">
    <ClientSettings>
        <DataBinding>
            <ItemTemplate>
                <div class="item">
                    #= Text#
                </div>
            </ItemTemplate>
            <EmptyDataTemplate>
                <div>No items</div>
            </EmptyDataTemplate>
            <DataService Location="~/Code/GenericHandlers/TestWS.asmx" DataPropertyName="Data" CountPropertyName="Count"
                DataPath="GetData" SortParameterType="Linq" FilterParameterType="Linq" />
        </DataBinding>
    </ClientSettings>
</telerik:RadListView>

Here is my TestWS.asmx (Json() simply convert the object to a Json string using the JavascriptSerializer):
<System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class TestWS
    Inherits System.Web.Services.WebService
 
    <WebMethod()> _
    Public Function GetData() As String
        Return Json(New With {Key .Data = New Temp() {New Temp("Item1"), New Temp("Item2")}, .Count = 2})
    End Function
 
End Class
 
Public Class Temp
    Private _text As String
 
    Public Property Text() As String
        Get
            Return _text
        End Get
        Set(ByVal value As String)
            _text = value
        End Set
    End Property
 
    Public Sub New(ByVal pText As String)
        _text = pText
    End Sub
End Class

When I run the page, I can see in the Chrome debugger that GetData is correctly called and return this: 
{"d":"{\"Data\":[{\"Text\":\"Item1\"},{\"Text\":\"Item2\"}],\"Count\":2}"}

But I can't understand why the ListView is still empty and don't show the data.

What did I miss there?

Jocelyn
Jocelyn
Top achievements
Rank 1
 answered on 02 Jul 2014
3 answers
114 views
Hi,

In my asp.net page i have a weird issue.

I have Rad Tree View and RAD Grid in the page.

I am using drag and drop of nodes from Tree view to Grid.

For the first Drag and Drop, the Ajax loading panel will not work. in the sense ajax will not be intiated the whole page gets refreshed.

Whereas for the second drag and drop the ajax loading panel will work fine without any issue,

May i know where i am going wrong.

Please advise
Maria Ilieva
Telerik team
 answered on 02 Jul 2014
2 answers
276 views
I'm trying to change the header font color on a dynamically added user control RadGrid without much success.  I can change the main data of the Radgrid in any way I like (colors, font size, background, etc..), but it seems this isn't the case with the header section of the Grid.

Using Chrome and looking at the grid via the "Elements" tab through the developer tool I can clearly see the rgb font color (color: rgb(255, 0, 0);) being applied to the header section, yet the color change is never visually shown.  I've even tried appending on "!important" which does nothing either. 

$('#ctl00_MainContent_Grid_7011_ctl00_Header th').css('color', _newColor);  //set color of Grid header text - doesn't work???
$('#ctl00_MainContent_Grid_7011_ctl00_Header').css('color', _newColor);  //set color of Grid header text - doesn't work???
$('#ctl00_MainContent_Grid_7011_GridHeader').css('color', _newColor);  //set color of Grid header text - doesn't work???

$('#ctl00_MainContent_Grid_7011_GridData').css('color', _newColor);            //set data color - this works just fine

A section of the Grid markup which shows the color being applied, yet visually unchanged:
​
<thead>
<tr class="rgMultiHeaderRow">
<th scope="col" id="ctl00_MainContent_Grid_7011_ctl00ExpandColumn1_MultiHeader-1" class="rgHeader rgExpandCol" rowspan="3" style="color: rgb(255, 0, 0);">&nbsp;</th><th scope="col" class="rgHeader" colspan="10" style="font-size: 12pt; font-weight: bold; color: rgb(255, 0, 0);">Type Performance</th>
 </tr><tr class="rgMultiHeaderRow">
<th scope="col" id="ctl00_MainContent_Grid_7011_ctl00Application0_MultiHeader2" class="rgHeader" rowspan="2" style="color: rgb(255, 0, 0);"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$MainContent$Grid_7011$ctl00$ctl02$ctl03$ctl00','')">Application</a></th>
Erik
Top achievements
Rank 1
 answered on 02 Jul 2014
9 answers
390 views

Hi There

I would like to make the visibility of GridNumericColumn of Telerik grid at runtime.

I have a control at my web page say dropdown box with three different values and what I want when dropdown box got a value single then I would like to make the visibility of GridNumericColumn to false.

I hope someone might be able to help me

Thanks

Syed

Viktor Tachev
Telerik team
 answered on 02 Jul 2014
1 answer
145 views
Hello,

I have used following line of to use Rad color picker for my
application:

<telerik:RadColorPicker runat="server"
ID="rcpMedian"
PaletteModes="WebPalette"
KeepInScreenBounds="false"
Overlay="true"
Visible="true"
ShowIcon="true"
Width="300"></telerik:RadColorPicker>

When I browsed my application, I found
the textboxes of R, G, B, H, S, B got displaced un evenly (please see attachement).



Can you please tell me solution of
this?

If there is no solution of it then
is there any way to remove these textboxes from color picker and to display
only HSB color grid?

Thanks,

pankaj



Slav
Telerik team
 answered on 02 Jul 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?