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

I am trying to bind a WCF service to my grid (client side). I believe I have checked all the boxes to make this happen but what I see in a grid with empty rows (which match the # of rows returned).

I added a break point at the radgrid_databinding event and at that point the grid says "11 items in 2 pages" but once I click OK on the alert message the grid says No Items to be Displayed.

What am I missing here? Your response will be greatly appreciated. I have gone through every example and followed it as well as I could.

The JSON response in my Firebug returns the following

  1. GetPublisherQueueResult: {Count:11,…}
    1. Count: 11
    2. Data: [{Delimeter:|, FileNamePrefix:GLB_CON_EOD_, Id:2, Name:EOD Constituent,…},…]
      1. 0: {Delimeter:|, FileNamePrefix:GLB_CON_EOD_, Id:2, Name:EOD Constituent,…}
      2. 1: {Delimeter:|, FileNamePrefix:GLB_IDX_EOD_, Id:3, Name:EOD Index,…}
      3. 2: {Delimeter:|, FileNamePrefix:GLB_IDX_DIV_EOD_, Id:4, Name:EOD Divisor,…}
      4. 3: {Delimeter:|, FileNamePrefix:GLB_IDX_DIV_SOD_, Id:5, Name:NSOD Divisor,…}
      5. 4: {Delimeter:|, FileNamePrefix:GLB_CON_SOD_, Id:6, Name:SOD Constituent,…}
      6. 5: {Delimeter:|, FileNamePrefix:GLB_IDX_CHG_, Id:7, Name:Change,…}
      7. 6: {Delimeter:|, FileNamePrefix:GLB_CON_EOD_, Id:8, Name:EOD Constituent,…}
      8. 7: {Delimeter:|, FileNamePrefix:GLB_IDX_EOD_, Id:9, Name:Index,…}
      9. 8: {Delimeter:|, FileNamePrefix:GLB_IDX_DIV_EOD_, Id:10, Divisor,…}
      10. 9: {Delimeter:|, FileNamePrefix:GLB_IDX_DIV_SOD_, Id:11, Divisor,…}
      11. 10: {Delimeter:|, FileNamePrefix:GLB_CON_SOD_, Id:12, Name:Constituent,…}

Here are my code snippets:

ASPX
<telerik:RadGrid ID="PublisherGrid" runat="server" AllowSorting="true" AllowPaging="true" AllowMultiRowSelection="true" AutoGenerateColumns="false">
            <MasterTableView ShowFooter="false" ItemStyle-Height="30px" AlternatingItemStyle-Height="30px">
                <Columns>
                    <telerik:GridClientSelectColumn UniqueName="Select" ItemStyle-Width="30px" HeaderStyle-Width="30px"></telerik:GridClientSelectColumn>
                    <telerik:GridBoundColumn HeaderText="Id" ItemStyle-Width="30px" HeaderStyle-Width="30px" DataField="Id" HeaderStyle-Wrap="false" ItemStyle-Wrap="false"/>                  
                    <telerik:GridBoundColumn HeaderText="Name" DataField="Name" HeaderStyle-Wrap="false" ItemStyle-Wrap="false"/>                   
                    <telerik:GridBoundColumn HeaderText="FileNamePrefix" ItemStyle-Width="120px" HeaderStyle-Width="120px" DataField="FileNamePrefix" HeaderStyle-Wrap="false" ItemStyle-Wrap="false" />                     
                    <telerik:GridBoundColumn HeaderText="Delimeter" ItemStyle-Width="70px" HeaderStyle-Width="70px" DataField="Delimeter" HeaderStyle-Wrap="false" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Center"/>                                         
                    <telerik:GridBoundColumn HeaderText="OutputLocation" DataField="OutputLocation" HeaderStyle-Wrap="false" ItemStyle-Wrap="false" />                   
                    <telerik:GridBoundColumn HeaderText="TimeStamp" ItemStyle-Width="120px" HeaderStyle-Width="120px" DataField="TimeStamp" HeaderStyle-Wrap="false" ItemStyle-Wrap="false" />
                    <telerik:GridBoundColumn HeaderText="Status" ItemStyle-Width="70px" HeaderStyle-Width="70px" DataField="Status" HeaderStyle-Wrap="false" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Center"/>
                </Columns>   
                <PagerStyle Mode="NextPrevAndNumeric" Position="Bottom" AlwaysVisible="true"></PagerStyle>           
            </MasterTableView>
            <ClientSettings EnableRowHoverStyle="true">                
                <Selecting AllowRowSelect="true"/>
                <Resizing AllowColumnResize="true"/>                                
                 
                <DataBinding    SelectMethod="GetPublisherQueue"                                
                                Location="http://localhost/Oyster.WCF/publisher.svc">                                 
                                 
                </DataBinding>     
                <ClientEvents OnDataBinding="RadGrid1_DataBinding" OnDataBindingFailed="function () {alert('binding failed');}" />
                                                                                             
            </ClientSettings>
            <SelectedItemStyle CssClass="SelectedItem" />
 
 
        </telerik:RadGrid>

This is the WCF code :
[ServiceContract]
     
    public interface IPublisher
    {
        [OperationContract(Name = "GetPublisherQueue")]
        [WebInvoke(Method="POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
        PublisherQueueData GetPublisherQueue(int startRowIndex, int maximumRows);              
    }
 
    [DataContract]
    public class PublisherQueue
    {
        [DataMember]
        public int Id { get; set; }
        [DataMember]
        public String Name { get; set; }
        [DataMember]
        public String FileNamePrefix { get; set; }
        [DataMember]
        public String Delimeter { get; set; }
        [DataMember]
        public String OutputLocation { get; set; }
        [DataMember]
        public String TimeStamp { get; set; }
        [DataMember]
        public String Status { get; set; }
    }
 
    public class PublisherQueueData
    {
        public int Count
        {
            get;
            set;
        }
        public List<PublisherQueue> Data
        {
            get;
            set;
        }
    }
 
 
/////
 
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [KnownType(typeof(PublisherQueue))]
    public class Publisher : IPublisher
    {
        List<PublisherQueue> publisherQueueList = new List<PublisherQueue>();
        PublisherQueueData publisherQueueData = new PublisherQueueData();
 
       public PublisherQueueData GetPublisherQueue(int startRowIndex, int maximumRows)
        {
            PopulatePublisherQueue();
 
            publisherQueueData.Data = publisherQueueList;
            publisherQueueData.Count = publisherQueueList.Count;
 
            return publisherQueueData;
        }    
 
        private void PopulatePublisherQueue()
        {
 
            Morningstar.Indexes.ETL.PublisherDataAccess publisherDataAccess = new PublisherDataAccess();
 
            using (DataTable publisherQueueDataTable = publisherDataAccess.GetPublisherData())
            {
                 
                for(int i = 0; i < publisherQueueDataTable.Rows.Count - 1; i++)
                {
                    PublisherQueue publisherQueueRecord = new PublisherQueue();
 
                    publisherQueueRecord.Id = Convert.ToInt32(publisherQueueDataTable.Rows[i]["PUBLISHER_ID"]);
                    publisherQueueRecord.Name = publisherQueueDataTable.Rows[i]["PUBLISHER_NAME"].ToString();
                    publisherQueueRecord.FileNamePrefix = publisherQueueDataTable.Rows[i]["FILE_NAME"].ToString();
                    publisherQueueRecord.OutputLocation = publisherQueueDataTable.Rows[i]["OUTPUT_LOCATION"].ToString();
                    publisherQueueRecord.Delimeter = publisherQueueDataTable.Rows[i]["DELIMETER"].ToString();
                    publisherQueueRecord.TimeStamp = publisherQueueDataTable.Rows[i]["PUBLISH_TIMESTAMP"].ToString();
                    publisherQueueRecord.Status = publisherQueueDataTable.Rows[i]["STATUS"].ToString();
 
                    publisherQueueList.Add(publisherQueueRecord);
 
                }
 
            }
        }
    }
BALA MUKUND
Top achievements
Rank 1
 answered on 24 Sep 2012
8 answers
133 views
Is it possible in the GroupItemDataBound event to change the skin, background-image or anything of a specific item?  I have found away to identify the item i want to change and can add a border to it, however i would like to change the background image.  Is this possible using c# or js?
Chris Salas
Top achievements
Rank 1
 answered on 24 Sep 2012
1 answer
138 views
I am trying to put RadToolTip in a composite control.. here is the code that I am trying to build....

public class OCToolTip : CompositeControl
    {
        private RadToolTip tip;
        private Image image;
 
        [Localizable(false)]
        protected override void CreateChildControls()
        {
            this.Controls.Clear();
 
            tip = new RadToolTip();
            image = new Image();
            image.CssClass = "helpImage";
            this.Controls.Add(image);
            this.Controls.Add(tip);
            tip.TargetControlID = image.ID;
            tip.IsClientID = true;
            tip.ShowEvent = ToolTipShowEvent.OnClick;
            tip.OnClientBeforeShow = "ShowToolTip";
        }
 
        protected override void Render(HtmlTextWriter writer)
        {
            AddAttributesToRender(writer);
            tip.RenderControl(writer);
        }
 
    }


It shows up the image but is not accepting the client click event. Any ideas what is wrong?

Thanks
SK

PS: I also tried to create a user control for RadToolTip but that did not work, the idea is that I need to use a help icon in various parts of my program and want to use radtooltip for that, is there an alternate solution?
SK
Top achievements
Rank 1
 answered on 24 Sep 2012
12 answers
277 views
Good afternoon,
I have created a image inside a column in code behind file:

protected

 

 

void CfnReportGrid_PreRender(object sender, EventArgs e)

 

{

 

 

RadGrid CFNGrid = (RadGrid)CfnReport.FindItemByValue("CfnDataRpt").FindControl("CfnReportGrid");

 

 

 

GridHeaderItem headerItem = (GridHeaderItem)CFNGrid.MasterTableView.GetItems(GridItemType.Header)[0];

 

 

 

Image img = new Image();

 

img.ID =

 

"PRImg";

 

img.ImageUrl =

 

"~/Image/Header_Info.jpg";

 

img.ImageAlign =

 

ImageAlign.Bottom;

 

img.ToolTip =

 

"Employee FileNo";

 

img.Width =

 

new Unit(10);

 

img.Height =

 

new Unit(9);

 

headerItem[

 

"EIS_ID"].Controls.AddAt(1, img);

 


When I export this grid to PDF I want to hide this image.In ItemCreated event I try to do this:

protected

 

 

void CfnReportGrid_ItemCreated(object sender, GridItemEventArgs e)

 

 

 

 

if(IsExport)

 

RadGrid

 

 

CFNGrid = (RadGrid)CfnReport.FindItemByValue("CfnDataRpt").FindControl("CfnReportGrid");

 

 

 

GridHeaderItem headerItem = (GridHeaderItem)CFNGrid.MasterTableView.GetItems(GridItemType.Header)[0];

 

 

 

Image img = (Image)headerItem.FindControl("PRImg");

 

img.Visible =

 

false;

But gettin runtime error:
Object reference not set to an instance of an object.

Please help me to resolve this issue.
Thanks so much

 

Vitaly
Top achievements
Rank 1
Iron
Iron
 answered on 24 Sep 2012
9 answers
1.4K+ views
Hi,


I am very new to asp.net and telerik so I apologize. I need help and I am not sure how to get this accomplished. Here is what I got. I have two radgrids one is being controlled by the other. the first grid will display a list of patients a therapist has on their case load. the second grid will display a list of visits each patient has. so the visits grid is be controlled by the selected value of the patient grid by PaitentID. Ok here is my problem when I add a visit for a patient I don't know how to automatically populate the patientID for the visit from the selected value on the patient grid. So I am not sure how to go about this so any help would be greatly appreciated. thanks

Alex
Top achievements
Rank 1
 answered on 24 Sep 2012
7 answers
1.6K+ views
Hi..
I'm trying to use onbeforeunload to check if the user is exiting a form before saving changes.
I'm using the AjaxPanel - But onbeforeunload is called on every single ajax request.
How can I test if the pages is REALLY being unloaded ?    Help...........
thanks again!!!!!!
Francis
Top achievements
Rank 2
 answered on 24 Sep 2012
1 answer
74 views
Hello,

I'm trying to deploy this msi: Telerik.Web.UI_2011_2_712_Dev.msi
the regular swithes work fine /qn but the installer launches IE and when deploying via SCCM the installation launches IE.

Is there any switches to suppress the IE window?

Regards

Leo
Leonardo
Top achievements
Rank 1
 answered on 24 Sep 2012
1 answer
118 views
How do I get Start time from RadSchedule on mouse-click? I need to assign that value to RadDateTimePicker in another div in same page.  Using vb.net, VS2010. 

Thanks in advance
Jayesh Goyani
Top achievements
Rank 2
 answered on 24 Sep 2012
2 answers
80 views
Hello

I start to use the new asp.net 4.5 template (vs 2012)  in a new project and telerik q2 2012 toghether.

Everything fine except for the size of a buttons, in radgrid, reportviewer...etc

The image buttons are huge size!!!

Any workaround? Am I missing something?

Thanks
Gilberto
Top achievements
Rank 1
 answered on 24 Sep 2012
1 answer
125 views
Hello,

I have a radscheduler with a SQL data source provider. I have reminders enabled for our radscheduler and I am having a few problems with the reminders themselves. The first issue is that the reminders never seem to go away even after clicking the dismiss button. After the dismiss button is clicked the reminder will appear every time I return to the page and it never seems to be updated in the Reminders column of the DB. I tried adding some custom code in the ReminderDismiss event, but the event never seems to fire which is my second issue. I have these events set up just like the insert/edit events so to speak. However whenever the reminder dialog appears and I click dismiss I am unable to hit this event. I tried the same thing with the snooze event. It never seems hits the event.

Here is my client side code: 
<telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="End"
        DataKeyField="ID" DataRecurrenceField="RecurrenceRule"
        DataRecurrenceParentKeyField="RecurrenceParentID" DataSourceID="SchedulerDataSource"
        DataDescriptionField="Description"
        Height="700px"
        OnAppointmentCommand="RadScheduler1_AppointmentCommand"
        StartInsertingInAdvancedForm="true"
        Reminders-Enabled="true"
        OnReminderSnooze="Reminder_Snooze"
        DataReminderField="Reminder"
        OnReminderDismiss="RadScheduler1_ReminderDismiss"
        StartEditingInAdvancedForm="true"
        OnFormCreated="RadScheduler1_FormCreated"
        AdvancedForm-EnableCustomAttributeEditing="true"
        OnAppointmentInsert="RadScheduler1_Scheduled_EventsInsert"
        OnAppointmentUpdate="RadScheduler1_Scheduled_EventsUpdate"
        CustomAttributeNames="AssetName, Parameters"
        DataStartField="Start" DataSubjectField="Subject" Skin="Sitefinity">
        <Localization AdvancedEditAppointment="Edit Event" AdvancedNewAppointment="New Event" />
        <AppointmentContextMenuSettings EnableDefault="true" />
        <AdvancedForm Modal="true" />
        <AppointmentTemplate>
                <%# Eval("Subject") %>
                <p style="font-style: italic;">
                <%# Eval("AssetName")%></p>
                <%# Eval("Parameters")%></p>
        </AppointmentTemplate>
        <TimelineView UserSelectable="false" />
    </telerik:RadScheduler>

As you can see set reminders-enabled to true I have my data reminder field and I have set my OnReminderDismiss event.

Here is my server side code:

protected void RadScheduler1_ReminderDismiss(object sender, ReminderDismissEventArgs e)
{
    // Lets do some custom code stuff...
         
    e.Cancel = true;
}

Have I missed something really obvious? Is there another property related to reminders that I must set?

Thanks in advance for your help. I do very much like the scheduler tool otherwise.

-Justin
Boyan Dimitrov
Telerik team
 answered on 24 Sep 2012
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?