Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
138 views
HI all,

I've got a grid that uses a web service as a datasource.  I've got a method in the web service to retrieve and filter data as needed.
The data retrieves and filter okay but when I select a row from the filter, client-side, then try to retrieve a value from the selected row in the filter it comes up with &nbsp& or no value.  However it works if I physically click on a row when I set up a row selected event to retrieve the value.

In other words, selecting a row in javascript code doesn't work.  Do I need to rebind the grid or something.  I've tried many different samples/solutions and nothing seems to work.

Here's the service, Grid, and Javascript from the client.
using System;
using System.Linq;
using System.Runtime.Serialization;
using System.Web.Services;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Collections.Generic;
using System.Collections;
using Telerik.Web.UI;
using System.Reflection;
  
namespace DC
{
    [DataContract]
    public class POCN_hdr
    {
         [DataMember]
        public int MfgAssocDocID { get; set; }
         [DataMember]
         public int? MfgOrderID { get; set; }
        [DataMember]
        public string ponumber { get; set; }
        [DataMember]
        public string vendname { get; set; }
        [DataMember]
        public string vendorid { get; set; }
        [DataMember]
        public string country { get; set; }
        [DataMember]
        public string vndclsid { get; set; }
        [DataMember]
        public DateTime? docdate { get; set; }
        [DataMember]
        public string hold { get; set; }
        [DataMember]
        public string shipmthd { get; set; }
    }
  
    [DataContract]
    public class POCN_det
    {
        [DataMember]
        public string ponumber { get; set; }
        [DataMember]
        public string itemnmbr { get; set; }
        [DataMember]
        public decimal? qtyorder { get; set; }
        [DataMember]
        public string itemdesc { get; set; }
        [DataMember]
        public string postatus { get; set; }
        [DataMember]
        public string shipmthd { get; set; }
        [DataMember]
        public DateTime? released_date { get; set; }
        [DataMember]
        public DateTime? prmdate { get; set; }
        [DataMember]
        public DateTime? reqdate { get; set; }
    }
}
  
public class MyData
{
    public int Count { get; set; }
    public IList Data { get; set; }
}
  
[ServiceContract]
[ServiceKnownType("GetKnownTypes")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class POCNAssocDocService
{
    public static IEnumerable<Type> GetKnownTypes(ICustomAttributeProvider provider)
    {
        List<Type> knownTypes = new List<System.Type>();
  
        knownTypes.Add(typeof(DC.POCN_hdr));
        knownTypes.Add(typeof(DC.POCN_det));
  
        return knownTypes;
    }
  
    [OperationContract]
    public MyData retrievePOCN_HdrDataAndCount(int startRowIndex, int maximumRows, string sortExpression, string filterExpression)
    {
        maximumRows = 20;
        if (filterExpression != "")
        {
            filterExpression = filterExpression.Replace("\"", string.Empty);
        }
        else
        {
            filterExpression = "MfgOrderID = -1";
        }
        GridBindingData data = RadGrid.GetBindingData("AppDataClassesDataContext", "MOAssocDocuments", startRowIndex, maximumRows, sortExpression, filterExpression);
        MyData result = new MyData();
        result.Data = data.Data.OfType<MOAssocDocument>().Select(c => new DC.POCN_hdr()
        {
            MfgAssocDocID = c.MfgAssocDocID,
            MfgOrderID = c.MfgOrderID,
            ponumber = c.POHdr.ponumber,
            vendname = c.POHdr.vendname,
            vendorid = c.POHdr.vendorid,
            country = c.POHdr.country,
            vndclsid = c.POHdr.vndclsid,
            docdate = c.POHdr.docdate,
            hold = c.POHdr.hold,
            shipmthd = c.POHdr.shipmthd
        }).ToList();
        result.Count = data.Count;
        return result;
    }
  
    [OperationContract]
    public MyData retrievePOCN_DetDataAndCount(int startRowIndex, int maximumRows, string sortExpression, string filterExpression)
    {
       // maximumRows = 50;
        if (filterExpression == "")
        {
            filterExpression = "qtyorder = -999999";
        }
        else
        {
            string sPoNumb = filterExpression.Substring(13, 8);
  
            AppDataClassesDataContext appDB = new AppDataClassesDataContext();
            var dq = from dqr in appDB.PODets where dqr.ponumber == sPoNumb select dqr;
  
            if (dq.Count() == 0)
            {
                filterExpression = "qtyorder = -999999";
            }
              
        }
  
        GridBindingData data = RadGrid.GetBindingData("AppDataClassesDataContext", "PODets", startRowIndex, maximumRows, sortExpression, filterExpression);
        MyData result = new MyData();
        result.Data = data.Data.OfType<PODet>().Select(o => new DC.POCN_det()
        {
            ponumber = o.ponumber,
            itemnmbr = o.itemnmbr,
            qtyorder = o.qtyorder,
            itemdesc = o.itemdesc,
            postatus = o.postatus,
            shipmthd = o.shipmthd,
            released_date = o.released_date,
            prmdate = o.prmdate,
            reqdate=o.reqdate
        }).ToList();
        result.Count = data.Count;
        return result;
    }
  
}
<telerik:RadGrid ID="rdGridAsgPOHdr" runat="server" AllowPaging="false" AllowSorting="false"
                                Height="100px" AllowFilteringByColumn="false"
                                GridLines="None" EnableEmbeddedSkins="false" Skin="WebBlue" AllowMultiRowSelection="false"
                                ItemStyle-Font-Names="'segoe ui',arial,sans-serif;" ItemStyle-Font-Size="9px"
                                AutoGenerateColumns="false" AlternatingItemStyle-Font-Names="'segoe ui',arial,sans-serif;"
                                AlternatingItemStyle-Font-Size="9px" HeaderStyle-Font-Names="'segoe ui',arial,sans-serif;"
                                HeaderStyle-Font-Size="9px">
                                <MasterTableView ClientDataKeyNames="ponumber" DataKeyNames="ponumber" AllowMultiColumnSorting="false"
                                    TableLayout="Fixed" NoMasterRecordsText="<div style='width: 705px; font-size: 9px; font-family: 'segoe ui',arial,sans-serif;'>No assigned po details to display.</div>">
                                    <CommandItemStyle CssClass="commViewCommand" />
                                    <ItemStyle CssClass="comments" />
                                    <AlternatingItemStyle CssClass="comments" />
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="ponumber" HeaderText="PO#" UniqueName="ponumber"
                                            ItemStyle-Width="40px" HeaderStyle-Width="40px" />
                                        <telerik:GridBoundColumn DataField="vendname" HeaderText="Vendor" UniqueName="vendname"
                                            ItemStyle-Width="400px" HeaderStyle-Width="400px" />
                                        <telerik:GridBoundColumn DataField="vendorid" HeaderText="VID" UniqueName="vendorid"
                                            ItemStyle-Width="40px" HeaderStyle-Width="40px" />
                                        <telerik:GridBoundColumn DataField="docdate" HeaderText="Doc Dt" UniqueName="docdate"
                                            DataFormatString="{0:MM/dd/yy}" ItemStyle-Width="35px" HeaderStyle-Width="35px" />
                                        <telerik:GridBoundColumn DataField="shipmthd" HeaderText="Ship Via" UniqueName="shipmthd"
                                            ItemStyle-Width="105px" HeaderStyle-Width="105px" />
                                        <telerik:GridBoundColumn DataField="detCnt" ItemStyle-Width="1px" ItemStyle-BackColor="White"
                                            HeaderStyle-Width="1px" ItemStyle-ForeColor="White" UniqueName="detCnt" ItemStyle-CssClass="commViewCommand">
                                        </telerik:GridBoundColumn>
                                          <telerik:GridBoundColumn DataField="MfgOrderID" DataType="System.Int32" HeaderText="MfgOrderID" HeaderStyle-Width="1px"
                                                        UniqueName="MfgOrderID" ItemStyle-Width="1px" ItemStyle-CssClass="commViewCommand">
                                                    </telerik:GridBoundColumn>
                                                         <telerik:GridBoundColumn DataField="MfgAssocDocID" DataType="System.Int32" HeaderText="MfgAssocDocID" HeaderStyle-Width="1px"
                                                        UniqueName="MfgAssocDocID" ItemStyle-Width="1px" ItemStyle-CssClass="commViewCommand">
                                                    </telerik:GridBoundColumn>
                                    </Columns>
                                </MasterTableView>
                                <ClientSettings>
                                          <DataBinding Location="../Services/POCNAssocDocService.svc" FilterParameterType="Linq" SelectMethod="retrievePOCN_HdrDataAndCount"
                                        SortParameterType="Linq">
                                    </DataBinding>
                                    <ClientEvents OnDataBinding="rdGridAsgPOHdr_DataBinding"/>
                                    <Selecting AllowRowSelect="true" />
                                    <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" />
                                </ClientSettings>
                            </telerik:RadGrid>
rdGridPOHdr = $find('<%= rlMOView.FindControl("rdGridAsgPOHdr").ClientID %>');
                   
                  var tableView = rdGridPOHdr.get_masterTableView();
                  tableView.filter("MfgOrderID", mfgID, "EqualTo");
                  tableView.clearSelectedItems();
                  var dataItem = tableView.get_dataItems()[0];
                  dataItem.set_selected(true);
                  var selectedRows = tableView.get_selectedItems();
                  for (var i = 0; i < selectedRows.length; i++) {
                      var row = selectedRows[i];
                      var cell = tableView.getCellByColumnUniqueName(row, "ponumber")
                      //here cell.innerHTML holds the value of the cell    
                  }
Jim
Top achievements
Rank 1
 answered on 02 Sep 2011
1 answer
194 views
Alright, I'm trying to create a pie chart that shows Locations in the Legend so that each location as a designated color, and the values assigned to each location is TotalSales. I thought it would be an easy thing to implement, but I'm running into issues.

When I implement the code below, it shows the TotalSales all around the pie chart (I know that's because of LabelLocation="Auto") but the legend on the right would just say "Series xx". I know how to get the name to change, but I don't know how to get it to create a new item for each location.

Can someone help me out with this?

Here's my code:

<telerik:RadChart ID="radSales" AutoLayout="true" runat="Server" Width="900px" Skin="Web20"
        Style="margin: 0px auto;">
        <Legend Visible="true">
            <Appearance GroupNameFormat="#VALUE">
            </Appearance>
        </Legend>
        <ChartTitle TextBlock-Text="Total Sales">
            <TextBlock>
                <Appearance TextProperties-Font="Verdana, 20px, style=Bold" TextProperties-Color="#00529B">
                </Appearance>
            </TextBlock>
        </ChartTitle>
        <PlotArea>
            <Appearance Dimensions-Margins="18%, 22%, 12%, 14%">
            </Appearance>
            <XAxis DataLabelsColumn="Location">
                <Appearance>
                    <TextAppearance TextProperties-Font="Verdana, 8pt, style=Bold">
                    </TextAppearance>
                </Appearance>
            </XAxis>
        </PlotArea>
        <Series>
            <telerik:ChartSeries DataXColumn="Location" DataYColumn="TotalSales" DefaultLabelValue="#Y{C}"
                Type="Pie">
                <Appearance>
                    <LabelAppearance LabelLocation="Auto">
                    </LabelAppearance>
                    <TextAppearance TextProperties-Font="Verdana, 11pt, style=Bold" TextProperties-Color="#00529B">
                    </TextAppearance>
                </Appearance>
            </telerik:ChartSeries>
        </Series>
    </telerik:RadChart>

Peshito
Telerik team
 answered on 02 Sep 2011
3 answers
153 views
hi,

i used RadScheduler control got an dll problem, when clicking the  "Week" tab in the top right side corner , it shows the all the week days bellow,we have an option to click the particular day tab on top , it shows the all the schedules on the day.    

using the telerik dll (2010.1.519.40) version
my problem is 
 when click the week tab  its not working  ( select the  Browser mode : IE7,IE8,IE9  and Document Model (Quirks ,IE7,IE8 )
 but its working at the time of ( select the  Browser mode : IE7,IE8,IE9  and Document Model (IE9 Standards (default) )

I took the latest dll (2011.1.413.40) ,  using this its working fine at all Document model ( Quirks ,IE7,IE8 and (IE9 Standards (default)) 

As per the client requirement  doesn't replace the  existing dll. 

How to solve this problem with out change the dll. 



Ivan Zhekov
Telerik team
 answered on 02 Sep 2011
2 answers
257 views
Hi i am using Terik.web.ui.dll


on the exporttoexcel option i want to dispaly loading image .

could you please help me.
Vibhor
Top achievements
Rank 1
 answered on 02 Sep 2011
7 answers
462 views

Hi,

I have one Rad Window, inside the rad window am calling an aspx page with some controls.  I am getting border for Rad window and also for the aspx page. I want to display the Rad window without any border.

Is it possible for me to hide the border of the rad window.?

i tried to give BorderStyle="None" But still border is comming.

Please help me to sort it out.

Thanks & Regards,
Sushanth Mathew

loowool
Top achievements
Rank 2
 answered on 02 Sep 2011
2 answers
283 views
Hello,
I have a page, which opens a dialog window (Window1). In Window1 there's a custom AJAX control with button which in turn opens new dialog window (Window2). When Window2 closes, a page must handle Window2's OnClientClose event, and Window2 must pass some data to my custom control on WIndow1. To avoid stack overflow, as you adviced here, I put handler on main page.
And now I want to get data sent by Window2 and put them to my control on Window1. This is how I'm doing that now:

 function referenceWindowClose(sender, args) {
            sender.remove_close(referenceWindowClose);
            var arg = args.get_argument();
            if (!arg) return;
            var ctl = $find(arg.TargetControlID);
            if (ctl == nullreturn;
            ctl.set_text(arg.Caption);
            ctl.set_value(arg.RefID);
        }
Variable named ctl is my custom AJAX control. Problem is ctl is always null. I know this happens because Window1 is in IFRAME. But how do I find it from main page? Using sender parameter? Please help.
Dmitry
Top achievements
Rank 1
 answered on 02 Sep 2011
1 answer
137 views
Hello,

I'm looking for code to drag and drop an image from a listbox to another listbox or another solution to achieve this functionality. The usecase is that a user can select from a list of images and drag & drop one or more images to another "placeholder". The next step is that I can save the dropped images to a database of filesystem. Can anyone point me to some examples or solution?

Thanks in advance

Patrick
Peter Filipov
Telerik team
 answered on 02 Sep 2011
15 answers
648 views
I have a RadAsyncUpload control on my page and I want to test all of my functionality for those clients that can't/don't have either Flash or Silverlight installed.

Using code found in this forum I have this in my markup just before the definition of the AsyncUpload control ...
  <script type="text/javascript">
    Telerik.Web.UI.RadAsyncUpload.Modules.Flash.isAvailable = function () { return false; }
  </script>
</para>

Now, when testing, I was expecting to:
  1. Not be able to select multiple file
  2. See an Add button to add a new file

So, I'm doing something wrong, it's broken or my expectations are wrong.

Which is it?

-- 
Stuart

Peter Filipov
Telerik team
 answered on 02 Sep 2011
1 answer
95 views
So I'm using the grid to manage a number of reference tables.  Most just have the identity and a text field, one has several text fields.  I'm doing it as generically as possible, with one grid and one SQLDataSource on the page, and 4 stored procs with generic parameters for insert, update, delete and select.  I have corresponding params for each action defined declaratively in the datasource.
<SelectParameters>
            <asp:Parameter Name="itemType" Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="itemType" Type="String" />
            <asp:Parameter Name="itemValue" Type="String" />
            <asp:Parameter Name="itemValue2" Type="String" />
            <asp:Parameter Name="itemValue3" Type="String" />
        </InsertParameters>
        <DeleteParameters>
            <asp:Parameter Name="itemID" Type="Int32" />
            <asp:Parameter Name="itemType" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="itemID" Type="Int32" />
            <asp:Parameter Name="itemType" Type="String" />
            <asp:Parameter Name="itemValue" Type="String" />
            <asp:Parameter Name="itemValue2" Type="String" />
            <asp:Parameter Name="itemValue3" Type="String" />
        </UpdateParameters>


I'm handling the Updating, Selecting etc... events for the datasource, and set the value of the datasource params there before it runs each command.
protected void dsActivity_Deleting(object sender, SqlDataSourceCommandEventArgs e)
        {
            int paramcount = e.Command.Parameters.Count;
  
            e.Command.Parameters["@itemID"].Value = e.Command.Parameters["@" + lstReference.Items[lstReference.SelectedIndex].Value + "ID"].Value.ToString();
            e.Command.Parameters["@itemType"].Value = lstReference.Items[lstReference.SelectedIndex].Value;
  
            while (e.Command.Parameters.Count > 2)
                e.Command.Parameters.RemoveAt(e.Command.Parameters.Count - 1);
        }


The problem I had to work around was that although the grid appends the field values to the params in the datasource events, the order of them is not consistent.  So that makes it hard to handle them in a generic manner since I can't use the index to reference them, not knowing what param might be in a given position.

I've worked around this since I ran into it, but it would have been a lot cleaner if I could depend on the parameters to be added in the same order.  This would be handy for certain scenarios like this if it would build that with the params in the corresponding order they were originally retrieved.

Marin
Telerik team
 answered on 02 Sep 2011
2 answers
77 views
Hi,

I am having two radtreeview, i want to do cut and paste the items between the trees. I can do mulitple select. I search for the cut and paste in radtree view. Is it available ?. If not please tell me how can i perform that.

Regards,
Xavier
Xavier
Top achievements
Rank 1
 answered on 02 Sep 2011
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?