Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
160 views
Heyas;

I have a grid that I am trying to put a combo box in as a filter for a specific column.  I manually created the items in the combo box, then created a RadCodeBlock with a javascript function inside that is supposed to apply the appropriate filter, OR remove all the filters on that column.  So far, when I select a filter that is supposed to be "EqualTo", it works, but when I try to remove the filters entirely, I get a "No records to display" message.  This is clearly not the case, and I am not sure what else to try.   I've perused the forums and tried the solutions there, as well as the tried the API reference.  In fact, I copy/pasted the code directly, substituting where necessary, but it still does not work.  I am hoping someone can help me out here.  Here's the relevant aspx code:

<telerik:RadGrid ID="gridAllSurveys"
    runat="server"
    AllowFilteringByColumn="True"
    AutoGenerateColumns="False"
    DataSourceID="dsAllSurveys"
    GridLines="None"
    AllowPaging="True"
    AllowSorting="True"
    PageSize="20">
    <mastertableview
        datakeynames="SessionID"
        datasourceid="dsAllSurveys">
        <commanditemsettings exporttopdftext="Export to Pdf" />
        <rowindicatorcolumn>
            <HeaderStyle Width="20px" />
        </rowindicatorcolumn>
        <expandcollapsecolumn>
            <HeaderStyle Width="20px" />
        </expandcollapsecolumn>
        <Columns>
            <telerik:GridBoundColumn
                DataField="SessionID"
                DataType="System.Int32"
                HeaderText="SessionID"
                ReadOnly="True"
                Visible="false"
                SortExpression="SessionID"
                UniqueName="SessionID">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn
                DataField="GuestEmail"
                HeaderStyle-HorizontalAlign="Center"
                ItemStyle-Width="150"
                FilterControlWidth="150"
                HeaderText="GuestEmail"
                SortExpression="GuestEmail"
                UniqueName="GuestEmail" />
            <telerik:GridDateTimeColumn
                DataField="SubmitDate"
                HeaderStyle-HorizontalAlign="Center"
                ItemStyle-HorizontalAlign="Center"
                ItemStyle-Width="120"
                FilterControlWidth="120"
                HeaderText="Submit Date"
                SortExpression="SubmitDate"
                UniqueName="SubmitDate" />
            <telerik:GridDateTimeColumn
                DataField="DateOfFirstEmail"
                HeaderStyle-HorizontalAlign="Center"
                ItemStyle-HorizontalAlign="Center"
                ItemStyle-Width="120"
                FilterControlWidth="120"
                HeaderText="1st Email"
                SortExpression="DateOfFirstEmail"
                UniqueName="DateOfFirstEmail" />
            <telerik:GridDateTimeColumn
                DataField="DateOfSecondEmail"
                HeaderStyle-HorizontalAlign="Center"
                ItemStyle-HorizontalAlign="Center"
                ItemStyle-Width="120"
                FilterControlWidth="120"
                HeaderText="2nd Email"
                SortExpression="DateOfSecondEmail"
                UniqueName="DateOfSecondEmail" />
            <telerik:GridDateTimeColumn
                DataField="DateOfThirdEmail"
                HeaderStyle-HorizontalAlign="Center"
                ItemStyle-HorizontalAlign="Center"
                ItemStyle-Width="120"
                FilterControlWidth="120"
                HeaderText="3rd Email"
                SortExpression="DateOfThirdEmail"
                UniqueName="DateOfThirdEmail" />
            <telerik:GridBoundColumn
                DataField="Status"
                HeaderStyle-HorizontalAlign="Center"
                ItemStyle-HorizontalAlign="Center"
                ItemStyle-Width="75"
                FilterControlWidth="75"
                HeaderText="Status"
                SortExpression="Status"
                UniqueName="Status" />
            <telerik:GridBoundColumn
                DataField="Quality"
                HeaderStyle-HorizontalAlign="Center"
                ItemStyle-HorizontalAlign="Center"
                ItemStyle-Width="90"
                FilterControlWidth="90"
                HeaderText="Survey Type"
                SortExpression="Quality"
                UniqueName="Quality" >
                <FilterTemplate>
                    <telerik:RadComboBox ID="RadComboBox1"
                        runat="server"
                        Width="90"
                        OnClientSelectedIndexChanged="SelectedIndexChanged">
                        <Items>
                            <telerik:RadComboBoxItem
                                Selected="True"
                                Text="Choose filter"
                                Value="" />
                            <telerik:RadComboBoxItem
                                Text="NoFilter"
                                Value="NoFilter" />
                            <telerik:RadComboBoxItem 
                                Text="positive"
                                Value="positive" />
                            <telerik:RadComboBoxItem 
                                Text="negative"
                                Value="negative" />
                        </Items>
                    </telerik:RadComboBox>
                    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                    <script type="text/javascript">
                        function SelectedIndexChanged(sender, args)
                        {
                            var tableView = $find("<%=gridAllSurveys.ClientID %>").get_masterTableView();
                             
                            if (tableView.filter("Quality", args.get_item().get_value()) == "NoFilter")
                            {
                                tableView.filter("Quality", "", Telerik.Web.UI.GridFilterFunction.NoFilter);
                            }
                            else {
                                tableView.filter("Quality", args.get_item().get_value(), "EqualTo");
                            }
                        }
                    </script>
                    </telerik:RadScriptBlock>
                </FilterTemplate>
            </telerik:GridBoundColumn>
            <telerik:GridButtonColumn
                ButtonType="LinkButton"
                CommandName="Select"
                HeaderStyle-HorizontalAlign="Center"
                ItemStyle-HorizontalAlign="Center"
                ItemStyle-Width="25"
                FilterControlWidth="25"
                Text="Detail"
                UniqueName="btnViewDetail" />
        </Columns>
    </mastertableview>
</telerik:RadGrid>

Any help would be appreciated.  The examples given in the documentation only provide examples using linq.  While I realize this may be the preferred method, what I am doing is upgrading an existing 2.x application.  Adding linq to it would be problematic.
Tsvetina
Telerik team
 answered on 02 Mar 2011
5 answers
524 views
Hello!

In my project I need to display employee listing in a hierarchical manner. The amount of data is pretty big to load all records from the data base and takes lots of time, sometimes it gives timeout exception etc. I found a solution to read only top nodes and then, when user expands one of the node, I add ID of the "expanded" employee into a list and then in my query I also check that employee supervisor belongs to this list. This allows to read from the database all top level nodes + children of all expanded nodes.

The problem is, that since I bind a reduced datasource to the grid, built-in filtering/searching mechanism of the grid has no access to the full data and so it doesn't search all employees. Is there a way to use FilterExpression with linq/dynamic linq queries? Or maybe there's some better solution?

Another related question is - is it possible to set ExpandMode per each item and not per TableView? In other words, if a node has been expanded, and child table has been rendered, can I set ExpandMode for this node to be ClientSide, so that there were no postbacks if a user collapses or expands this node again? It's possible for tree-views, if I set

e.Node.ExpandMode =

TreeNodeExpandMode.ClientSide

 

in NodeExpand event handler. But I guess that won't work with the grid, right?

Thank you very much in advance!!!
Andy.
Andy
Top achievements
Rank 1
 answered on 02 Mar 2011
6 answers
183 views
Hi,

I am facing another Problem with RadGrid:

I have grouped my data and added a checkbox to the groupheader with this code:

protected void rtl_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridGroupHeaderItem)
            {
                GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item;
                DataRowView groupDataRow = (DataRowView)e.Item.DataItem;
  
                CheckBox chk = new CheckBox();
                item.DataCell.Controls.Add(chk);
            }
}

This is working. Every groupheader contains a checkbox.

After a postback, I want to get the state of this checkbox:

foreach (GridGroupHeaderItem headerItem in rtl.MasterTableView.GetItems(GridItemType.GroupHeader))
                {
                      
                        CheckBox chkbx = (CheckBox)headerItem.DataCell.Controls[0];                                           
                }

But now,  the controls collection of the headeritem.DataCell is empty. What is wrong here?
Pavlina
Telerik team
 answered on 02 Mar 2011
3 answers
177 views
Hi,
I am using Telerik RadScheduler.

I have a few questions to pose:

1) In my design, the admin is given the control of setting the date and time slots which is reflected to the user. I am able to do this successfully. What I want is, 

a) The time slots not scheduled by the admin should be reflected in black color. The user should be disabled from selecting this appointments as these are not scheduled. It should be displayed in black in day, week and month view.
b) Appointment already completed or already finished should be displayed in red color.
c) Available appointments for the future should be in blue color and as soon as the admin sets the schedule for a particular time it should be displayed in green and the unselected time in black.

For example:
lets take the example of March 23.
Initially all the appointment slots should be in Blue.If the admin selects, 7 am to 3 pm on March 23, then the slots from 7 am to 3pm should be in green and the rest 12 am to 7 am and 3 pm to 11:59 pm should be in black and the user should be disabled from selecting these black slots.
And soon as Mar 23 goes away, the color should be reflected Red.

2) When a user selects an appointment, it should be reflected in the scheduler which is happening. But as soon as the user selects his appointment, his name should be reflected at the admin side. I have taken the details of the user and have his credentials.

Looking for ward to your reply.Thank You.
Peter
Telerik team
 answered on 02 Mar 2011
7 answers
158 views
When use grid in scrolling mode, there is scroll bar on right and that is ok. But when apply some filter so all items fit on 1 page, scroll bar dissaperar (what is normal), but all columns are moved to the right and are no longer aligned with the header. I use % column width so columns move to right when there is no scroll bar. How to tell column header to also move to the right to be aligned with data? Or, how to set scroll bar always visible to hold fixed columns width?
Pavlina
Telerik team
 answered on 02 Mar 2011
1 answer
81 views
Hi,
I am using Telerik RadScheduler and I want to design this scheduler in such a way that the user should be able to view only the time slot and date set by the administrator.
I am able to do that using customization provided in the page http://demos.telerik.com/aspnet-ajax/scheduler/examples/customization/defaultcs.aspx.

But, this is working only in Day view. If the user selects month or week view, the scheduler shows even the time slots not set by the admin and the user is even able to select them.
What I want is: I want the dates and time not set by the admin to be BLOCKED. A blocked message should be set.How do i do that?


Peter
Telerik team
 answered on 02 Mar 2011
1 answer
106 views
If I set the Datasource in the Page_Laod event the paging does'nt work if the page mode is set to slider (see code) - in other modes it works:


Protected

 

 

Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

 

 

 

If Page.IsPostBack = False Then

 

SPCommand = db.GetStoredProcCommand(

 

"SEARCH_NET_Wogehmahin")

 

 

db.AddParameter(SPCommand,

 

"ReturnValue", DbType.Int32, 0, ParameterDirection.ReturnValue, False, 0, 0, "", DataRowVersion.Default, Nothing)

 

 

db.AddInParameter(SPCommand,

 

"Suchbegriff", DbType.AnsiString, Request("Suchbegriff"))

 

 

 

 

Using dataReader As DataSet = db.ExecuteDataSet(SPCommand)

 

 

RadListView1.DataSource = dataReader

 

RadListView1.DataBind()

 

 

 

End Using

 

 

 

End If

 

 

 

End Sub

 

Marin
Telerik team
 answered on 02 Mar 2011
2 answers
130 views
I am trying to determine how to get the original values from the record I am trying to update and what the changed values are in the code behind.  I can not figure out which event and what syntax to use to get these values when the user hits the "Update" link.  Any help would be appreciated.

Todd
Todd
Top achievements
Rank 1
 answered on 02 Mar 2011
5 answers
199 views
Hello Admin,

i am getting problem with RadDateTime picker control i.e.while clicking to edit the time in the date control field ,The date gets changed to the today's date,and existing date was changed,This should not be happen i only need to change the time,

Please provide me any solution on this ASAP,

Thanks

Radoslav
Telerik team
 answered on 02 Mar 2011
1 answer
72 views
Hello Admin,

I am implementing the radscheduler. In the appointments table i have a field IsEdited which is to be updated if and only if the date and time of the appointment is changed. I have used the following code which works fine for the simple appointment and also for the recurring appointments while editing the series. When I tried to update an occurence of the appointment the master's IsEdited field gets updated, but the occurence's field doesn't.
protected void rsAppointments_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
{
     if (e.ModifiedAppointment.Start != e.Appointment.Start || e.ModifiedAppointment.End != e.Appointment.End)
       {
                    e.ModifiedAppointment.Attributes["IsEdited"] = "1";
         
}
I want only the occurence's IsEdited field to be updated while updating the particular occurence and while editing the series the Master's field should be updated. How i can achive this?
Please Help me........

Thanks and regards,
roshani
Peter
Telerik team
 answered on 02 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?