Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
210 views
Hi all,

I'm kind'a new to the Telerik components (work with them everyday but in basic stuff), because we (company) used it for more than 2 years now, I decided to use them (extensively) in a new project I have in hands, and even reading the entire Paging content inside the Grid section for more than 3 times now, I can't find what I'm doing wrong.

I have a Grid control that looks like this:

<telerik:RadGrid ID="gvResult" CssClass="tblQuery queryWindow maxSize ui-widget-content" 
        runat="server" GridLines="None" CellPadding="15" AutoGenerateColumns="False" 
        PageSize="25" AllowPaging="True" OnRowDataBound="gvResult_RowDataBound" onpageindexchanging="gvResult_PageIndexChanging" 
        Skin="Web20" onneeddatasource="gvResult_NeedDataSource"
        <MasterTableView> 
            <NoRecordsTemplate> 
                Hummmm, there is nothing to show, the search result in absolutly nothing! Maybe you want to <href="javascript:history.back(-1);">go back</a> and search again with other parameters? 
            </NoRecordsTemplate> 
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
        </MasterTableView> 
        <HeaderStyle HorizontalAlign="Left" /> 
        <ItemStyle HorizontalAlign="Left" /> 
        <AlternatingItemStyle HorizontalAlign="Left" /> 
    </telerik:RadGrid> 

simple right ? ...

and on code behind on PageLoad I populate the Data
protected void Page_Load(object sender, EventArgs e) 
    if (!IsPostBack) 
        PopulateData(); 
}

where inside the PopulateData method I call a method that creates a DataTable and attach it to the Grid DataSource.

The DataTable is created with static columns and dynamic, so I never know the column size, only on runtime.

My CreateSource method dos this in summary:

1 - Creates a new DataTable object
2 - Creates 5 DataColumns (statict columns) and adds them into the DataTable object
3 - Loops through all dynamic columns and adds the same way

4 - For each Business Object in my Collection I add the Data into a DataRow and attach it to the DataTable.Rows Collection

5 - Foreach DataColumn in DataTable.Columns I Bound the DataFields, GridCheckBoxColumn, GridHyperlinkColumn and GridBoundColumn respectivly by my Business Object type

6 - Keep this DataTable object into a Session Variable
7 - RadGrid.DataSource = myDataTable

that works fine, and it is show lovely on the rendered page... but! (there's always a but) :-( 
I can't work with the pagging, when I press any other page I do not get my data, but the Column Type .ToString() :-/

Reading the help I created a method (NeedDataSource) and added this code into it:
protected void gvResult_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
    if (HttpContext.Current.Session["EDSWebSearch-SearchReturn-DataTable"] != null
    { 
        gvResult.DataSource = (DataTable)HttpContext.Current.Session["EDSWebSearch-SearchReturn-DataTable"]; 
    } 
    else 
    { 
        edsDebug.Write("Session Expired, redirecting to Start page"); 
        Response.Redirect("default.aspx" + Request.Url.Query); 
    } 

The DataTable contains all items I need, what should I do here?


screenshots attached, screencast here: (35 sec: 1,35Mb) http://bit.ly/6xxxMV

Thank you,
// Bruno Alexandre, using Soren's account.





Yavor
Telerik team
 answered on 01 Dec 2009
1 answer
117 views
In design time, binding to and object datasource returns a "ID could not be set to property DataFieldID". However, if I run the application it works fine.

I'm testing http://www.telerik.com/help/aspnet-ajax/menu_dataobjectdatasources.html

Any idea?
I'm using Q2.2009
Jorge
Top achievements
Rank 1
 answered on 01 Dec 2009
3 answers
73 views
Hi,

I am facing an interesting problem with Grid having Child Table and with Slider paging.
When I expand and collapse child row, after collapse the pager of child table still gets displayed.
I have attached screen shots for the reference.

Thanks,
Avi
Pavlina
Telerik team
 answered on 01 Dec 2009
1 answer
327 views
Dear Telerik
                       I placed a radcombobox inside a radgrid.I have autopostback set to true. I am using a GridTemplateColumn inside that I have filtertemplate inside that I placed a radcombobox .I also have itemtemplate inside that I have a checkbox.The combobox is populated with three values attended,unattended and all.when I select unattended/all in radcombobox it is showing the selectedvalue as attended only after postback.If attended is selected in radcombobox then the check boxes appears as checked.If unattended is selected from radcombobox then the checkboxes appears as unchecked.Please let me know what is wrong here.urgent please...

Here is the lines of code of importance

<telerik:GridTemplateColumn ShowFilterIcon="false" HeaderText="Attendance"  CurrentFilterFunction="EqualTo">
    <FilterTemplate>
    <telerik:RadComboBox ID="cmbAttend" runat="server"  DataTextField="ATTENDANCE_TYPE_DESC" DataValueField="ATTENDANCE_TYPE_ID"
    EnableViewState="true"  AutoPostBack="true">
    </telerik:RadComboBox>
    </FilterTemplate>
    <ItemTemplate>
    <asp:CheckBox ID="chkAttend" runat="server" />
    </ItemTemplate>
    </telerik:GridTemplateColumn>


aspx code


<telerik:RadGrid ID="gvEventHistory" skin ="Default" runat="server" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true"  PageSize="100"
     AllowFilteringByColumn="true" OnItemDataBound="gvEventHistory_ItemDataBound" OnItemCreated="gvEventHistory_ItemCreated"      OnNeedDataSource="gvEventHistory_NeedDataSource">
    <GroupingSettings CaseSensitive="false" />
    <MasterTableView DataKeyNames="SCHEDULE_EVENT_ID" ClientDataKeyNames="SCHEDULE_EVENT_ID" AllowFilteringByColumn="True">
    <RowIndicatorColumn>
    <HeaderStyle Width="2px" />
    <ItemStyle Width ="10px" />
    </RowIndicatorColumn>
   <Columns>
<telerik:GridTemplateColumn ShowFilterIcon="false" HeaderText="Attendance"  CurrentFilterFunction="EqualTo">
    <FilterTemplate>
    <telerik:RadComboBox ID="cmbAttend" runat="server"  DataTextField="ATTENDANCE_TYPE_DESC" DataValueField="ATTENDANCE_TYPE_ID"
    EnableViewState="true"  AutoPostBack="true">
    </telerik:RadComboBox>
    </FilterTemplate>
    <ItemTemplate>
    <asp:CheckBox ID="chkAttend" runat="server" />
    </ItemTemplate>
    </telerik:GridTemplateColumn>
   </Columns>
    </MasterTableView>
    <ClientSettings Selecting-AllowRowSelect="true">
    </ClientSettings>
    </telerik:RadGrid>

C# code

protected void Page_Load(object sender, EventArgs e)
    {

        aEmpNo = Convert.ToInt32(Request.QueryString["empno"]);
        if (!Page.IsPostBack)
        {
            //Load all events default view
            m_EmpEventHistoryList = EmployeeEventHistoryManager.Instance.GetEventHistory(aEmpNo );
            gvEventHistory.DataSource = m_EmpEventHistoryList;
            gvEventHistory.DataBind();

        }
    }



protected void gvEventHistory_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        m_EmpEventHistoryList = EmployeeEventHistoryManager.Instance.GetEventHistory(this.EmployeeNoParameter);
        gvEventHistory.DataSource = m_EmpEventHistoryList;
    }
   

    protected void gvEventHistory_ItemDataBound(object sender, GridItemEventArgs e)
    {
        RadComboBox cmbEventType = null;
        RadComboBox cmbAttend = null;
        string aAttendValue = string.Empty;
        int aIndex = 0;
        string SelectedValue = "1";

        //Get the eventtypedesc from event_type table
        //GetScheduleEvent will bring all the events and bind it to combobox
        IList<ScheduleEvent> m_ScheduleList = ScheduleEventManager.Instance.GetScheduleEvent();

        //Get this list and bind them to cmbattend combobox which contains attended,unattended
        //all rows
        IList<EmployeeEventHistory> m_EmployeeEventAttendedList = EmployeeEventHistoryManager.Instance.GetEventAttendedDetails();

        if (e.Item is GridFilteringItem)
        {
              cmbAttend = (RadComboBox)e.Item.FindControl("cmbAttend");

             cmbAttend.DataSource = m_EmployeeEventAttendedList;
            cmbAttend.DataBind();
             

        }

}

protected void gvEventHistory_ItemCreated(object sender, GridItemEventArgs e)
    {
        RadComboBox cmbEventType = null;
        RadComboBox cmbAttend = null;
        if (e.Item is GridFilteringItem)
        {
             //Get the cmbAttend RadComboBox
            cmbAttend = (RadComboBox)e.Item.FindControl("cmbAttend");
            cmbAttend.ID = "cmbAttend";
            cmbAttend.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(cmbAttend_SelectedIndexChanged);
        }
    }



void cmbAttend_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        IList<WW.FS.SPSS.Business.Employee.EmployeeEventHistory> m_EmpEventHistoryList = null;
        string All = "All";

        int Attended = 1;
        int UnAttended = 2;

        RadComboBox cmbAttend = (RadComboBox)o;
        int aAttendTypeId = 0;
        int aCounter = 0;

        //If All is selected then this code block must be executed
        if (cmbAttend.Text.ToString().ToUpper().Trim() == All.ToUpper().Trim())
        {
            aAttendTypeId = Convert.ToInt32(cmbAttend.SelectedValue.ToString());
            m_EmpEventHistoryList = EmployeeEventHistoryManager.Instance.GetEmpEventAttendance(aAttendTypeId);
            foreach (GridDataItem aGridItem in gvEventHistory.Items)
            {
                if (aGridItem.ItemType == GridItemType.Item)
                {
                    CheckBox chkAttended = (CheckBox)aGridItem.FindControl("chkAttend");
                    if (chkAttended != null)
                    {
                            if (Convert.ToString(m_EmpEventHistoryList[aCounter].ATTENDANCE_TYPE_ID).ToUpper().Trim() == Convert.ToString(Attended).ToUpper().Trim())
                            {
                                chkAttended.Checked = true;

                            }
                            else
                                if (Convert.ToString(m_EmpEventHistoryList[aCounter].ATTENDANCE_TYPE_ID).ToUpper().Trim() == Convert.ToString(UnAttended).ToUpper().Trim())
                                {
                                    chkAttended.Checked = false;

                                }
                       
                         }
                }

            }

            gvEventHistory.DataSource = m_EmpEventHistoryList;
            gvEventHistory.DataBind();





Thanks and Regards
Sri
Yavor
Telerik team
 answered on 01 Dec 2009
1 answer
145 views
Hi,

I found a blog with explanation and example of using RadcomboBox in MVC with LoadOnDemand.
I used the same version of Telerik.Web.UI and the same code but combo box on my page is totally disabled. RadComboBox in my case is placed in a partial view. I read somewhere that there is a problem with css styles if RadControls are placed in partial views but I couldn't find the solution to this.
However, when I placed it in a regular view page (non partial view) I got exception stating that control could not be modified inside server tags <%..%>. For that I found numerous solutions but none worked for me.
Do you have any suggestion of how to make ComboBox operational in partial view?
Do I maybe have to refer to all the JavaScript files needed for RadComboBox directly on the view page?

Thanks in advance.

Here's the sample of the partial view, if it means anything:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<EmailMarketing.Web.Models.MailingDetailsModel>" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<%@ Import Namespace="EmailMarketing.Web" %> 
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> 
<telerik:RadStyleSheetManager runat="server"
</telerik:RadStyleSheetManager> 
<div class="divMailingList"></div> 
<div id="MailingDetailsDiv"
  <div id="MailingData"
    <%= Html.Hidden("Id", Model.Id)%> 
    <div class="MailingDetailsForm"
      <div class="MailingDetailsLabel"
        <label for="MailingTypeId"
          <%= EMResources.MailingDetailsLabelPreferedAddress %></label
      </div> 
      <div class="MailingDetailsValue"
        <telerik:RadComboBox runat="server" ID="AddressTypeId" EnableLoadOnDemand="true" ShowMoreResultsBox="true" EmptyMessage="Type here ..." Height="200px" Enabled="true"
          <WebServiceSettings Path="Mailing" Method="LoadItems" /> 
        </telerik:RadComboBox> 
      </div> 
    </div>    
  </div> 
</div>  

Georgi Krustev
Telerik team
 answered on 01 Dec 2009
5 answers
107 views

Hi,

1. I am using the scheduler to creating arecurring appointments, as pre the documentations RecurenceParentId should have been created for theentry. But, I find the value as null 

2. How, where do I find the value and How cani Check for conflicting appointments?.

3. Can you send me any sample code?

Thanks

Sabarish



Peter
Telerik team
 answered on 01 Dec 2009
3 answers
79 views
I am trying to get aggregate totals to appear for each group that I have specified in my grid.  I get a grid footer total for each column but I don't get a group footer total.  The group footer does not appear at all for the specified groups.  I think I have set all required ShowGroupFooter and ShowGroupPanel settings.  I will attach the code for how I have setup my grid.  I was wondering if anyone can point out what I am doing wrong.

I am using version 2008.3.1105.20 of the Telerik.dll.

Thanks in advance for the help.

<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPages/Main.master" AutoEventWireup="false" CodeFile="timeOffSummaryReport.aspx.vb" Inherits="Applications_Vacation_timeOffSummaryReport" %>  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>  
 
<asp:Content ID="Content1" ContentPlaceHolderID="headSection" Runat="Server">  
</asp:Content>  
<asp:Content ID="Content2" ContentPlaceHolderID="actionbarSection" Runat="Server">  
</asp:Content>  
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" Runat="Server">  
 
<div>  
<telerik:RadDatePicker runat="server" ID="dtDateFrom"></telerik:RadDatePicker>  
<telerik:RadDatePicker runat="server" ID="dtDateTo"></telerik:RadDatePicker>  
<asp:Button runat="server" ID="btnGo" Text="Go" />  
</div>  
<div>  
<telerik:RadGrid ShowGroupPanel="True" AutoGenerateColumns="False"   
        ID="grdTimeOffSummary" AllowSorting="True" ShowFooter="True" runat="server"   
        GridLines="None">  
<HeaderContextMenu EnableTheming="True">  
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>  
</HeaderContextMenu>  
 
    <MasterTableView ShowGroupFooter="true" ShowFooter="true" AllowMultiColumnSorting="true">  
<RowIndicatorColumn>  
<HeaderStyle Width="20px"></HeaderStyle>  
</RowIndicatorColumn>  
 
<ExpandCollapseColumn>  
<HeaderStyle Width="20px"></HeaderStyle>  
</ExpandCollapseColumn>  
            <Columns>  
                <telerik:GridBoundColumn DataField="theDate" HeaderText="Date"></telerik:GridBoundColumn>  
                <telerik:GridBoundColumn Aggregate="Sum" FooterText="Total Vacation:" DataField="vacation" HeaderText="Vacation"></telerik:GridBoundColumn>  
                <telerik:GridBoundColumn Aggregate="Sum" FooterText="Total Personal:" DataField="personal" HeaderText="Personal"></telerik:GridBoundColumn>  
                <telerik:GridBoundColumn Aggregate="Sum" FooterText="Total Sick:" DataField="sick" HeaderText="Sick"></telerik:GridBoundColumn>  
                <telerik:GridBoundColumn Aggregate="Sum" FooterText="Total Compassionate:" DataField="compassionate" HeaderText="Compassionate"></telerik:GridBoundColumn>  
                <telerik:GridBoundColumn Aggregate="Sum" FooterText="Total Leave of Absence:" DataField="leaveOfAbsence" HeaderText="Leave Of Absence"></telerik:GridBoundColumn>  
                <telerik:GridBoundColumn Aggregate="Sum" FooterText="Total Parental Leave:" DataField="parentalLeave" HeaderText="Parental Leave"></telerik:GridBoundColumn>  
                <telerik:GridBoundColumn Aggregate="Sum" FooterText="Total Bereavement:" DataField="bereavement" HeaderText="Bereavement"></telerik:GridBoundColumn>  
                <telerik:GridBoundColumn Aggregate="Sum" FooterText="Total Education:" DataField="education" HeaderText="Education"></telerik:GridBoundColumn>  
                <telerik:GridBoundColumn Aggregate="Sum" FooterText="Total Jury Duty:" DataField="juryDuty" HeaderText="Jury Duty"></telerik:GridBoundColumn>  
                <telerik:GridBoundColumn Aggregate="Sum" FooterText="Total Banked Hours:" DataField="bankedHours" HeaderText="Banked Hours"></telerik:GridBoundColumn>  
            </Columns>  
            <GroupByExpressions>  
                <telerik:GridGroupByExpression>  
                    <GroupByFields>  
                        <telerik:GridGroupByField FieldName="employeeName" />  
                    </GroupByFields>  
                    <SelectFields>  
                        <telerik:GridGroupByField FieldName="employeeName" HeaderText="Employee" />  
                    </SelectFields>  
                </telerik:GridGroupByExpression>  
            </GroupByExpressions>  
    </MasterTableView>  
    <ClientSettings AllowDragToGroup="true" />  
 
<FilterMenu EnableTheming="True">  
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>  
</FilterMenu>  
</telerik:RadGrid>  
</div>  
 
</asp:Content> 
Pavlina
Telerik team
 answered on 01 Dec 2009
1 answer
206 views
After data binding with NeedDataSource, where is the appropriate place to toggle all items into edit mode and how?

Cheers,
Colin
Rosen
Telerik team
 answered on 01 Dec 2009
1 answer
307 views
I'm using the ComboBox to select from a list of Titles.  Some titles are quite long and look fine when word-wrapped in the dropdown section, but they don't fit in the single line input text tag.

Since it's an input text and not a textarea is there any way to allow a taller input field with word-wrapping?


Princy
Top achievements
Rank 2
 answered on 01 Dec 2009
3 answers
97 views
Hi,

In my radgrid , I ve a grid client select column and also have paging turned on for radgrid with page size to 10.

Right now, if I select the header checkbox, only 10 records on first page gets selected. I sthere anyway , I can do so that if I check the header checkbox, I can have all the items across pages selcted.
For eg if I've 24 items , in first page I've 10 items, 2nd page I've 10 items and on 3rd page ,I've 4 items. Is ther any way ,if I select the header on firstpage, I can selct all 24 items.

Pls help me with code.

Thanks,
ZR

Pavlina
Telerik team
 answered on 01 Dec 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?