Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
143 views

Hello,

I have a RadGrid with a DropDownList in its edititem Template area.

I would like to color the items depending on Org Name.

 

Here is the RadGrid definition  (I just removed columns before and after for ease of reading)

<telerik:RadGrid ID="RadExamGrid" runat="server" AutoGenerateColumns="False"
                 AllowSorting="True"  ExportCellFormating="RadExamGrid_ExportCellFormatting"
                 GridLines="Both" EnableViewState="True"
                MasterTableView-AllowSorting="True" PagerStyle-AlwaysVisible="True"
                  PagerStyle-Position="TopAndBottom" ResolvedRenderMode="Classic"
                  OnNeedDataSource="RadExamGrid_NeedDataSource" Skin="Sunset" >
                 <ExportSettings ExportOnlyData="True" FileName="Allocation"
                    HideStructureColumns="True" OpenInNewWindow="True" Excel-FileExtension="xls" Excel-Format="Biff" SuppressColumnDataFormatStrings="True">
                    <Excel Format="Biff" />
                </ExportSettings>
                <MasterTableView AllowPaging="True" PageSize="10" CommandItemDisplay="Top" Caption="Exams Received"
                InsertItemPageIndexAction="ShowItemOnCurrentPage" DataKeyNames="EntryNum" OverrideDataSourceControlSorting="True" CommandItemSettings-ShowExportToExcelButton="True" CommandItemSettings-ShowExportToPdfButton="False" CommandItemSettings-ShowExportToWordButton="True" >
 
                    <Columns>
<%   COLUMNS before not included %>
                    
 
                      <%--Org No Column --%>
                    <telerik:GridTemplateColumn HeaderText="Org Name" SortExpression="OrgName" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="250px">
                        <ItemTemplate>
                            <%# DataBinder.Eval(Container.DataItem, "OrgName")%>
                        </ItemTemplate>
                       <EditItemTemplate>     
                            <telerik:RadDropDownList ID="RadddlOrg" runat="server" AutoPostBack="True" Width="300px" DataTextField="OrgName" DataValueField="OrgNo" SelectedValue='<%# DataBinder.Eval(Container.DataItem, "OrgNo")%> ' OnSelectedIndexChanged="RadddlOrg_SelectedIndexChanged" CausesValidation="false">
                            </telerik:RadDropDownList>
                     
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Field is required" ControlToValidate="RadddlOrg" Display="Static" Font-Bold="True" SetFocusOnError="True" ForeColor="#FF0000"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
 
<%   COLUMNS after not included %>
            
                    </Columns>
 
                    <EditFormSettings EditColumn-ButtonType="PushButton">
                        <EditColumn FilterControlAltText="Filter EditCommandColumn1 column"
                            UniqueName="EditCommandColumn1">
                        </EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <PagerStyle Position="TopAndBottom" />
            </telerik:RadGrid>

 

 

Here is my RadGrid Item DataBound method.

 

Protected Sub RadExamGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadExamGrid.ItemDataBound
        Dim cmdItem As GridCommandItem = DirectCast(RadExamGrid.MasterTableView.GetItems(GridItemType.CommandItem)(0), GridCommandItem)
        Dim intResult As Integer = 0
 
        If TypeOf e.Item Is GridDataItem Then
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
            Dim btnDelete As ImageButton = DirectCast(item("ReceivedCommand").Controls(0), ImageButton)
            Dim itemValue As String = item.DataItem("RCVDTS")
            If itemValue.Trim = "" Then
                btnDelete.Visible = True
            Else
                btnDelete.Visible = False
            End If
 
        End If
 
        ''want dropdownlist for edit;
        If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then
            Dim editItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
            Dim drpOrg As Telerik.Web.UI.RadDropDownList = DirectCast(editItem.FindControl("RadddlOrg"), Telerik.Web.UI.RadDropDownList)
            Dim txtStudno As Telerik.Web.UI.RadTextBox = DirectCast(editItem.FindControl("RadtxtStudNo"), Telerik.Web.UI.RadTextBox)
 
            For i = 0 To objEXR.OrgNameDataView.Count - 1
                Dim li As New DropDownListItem
                li.Value = objEXR.OrgNameDataView.Item(i).Item(0)
                li.Text = objEXR.OrgNameDataView.Item(i).Item(1)
                If li.Text.Trim = "4HR CHALLENGER EXAM SESSION" Then
                    li.ForeColor = System.Drawing.Color.Blue
                End If
                drpOrg.Items.Add(li)
            Next
 
            If txtStudno.Text.Trim = "" Then
                txtStudno.Text = "1"
            End If
 
 
        End If
 
 
 
    End Sub

 

I read some articles on RadDropDownList.VisualListItemFormatting Event, but was unsuccessful to implement it.  I went with simple approach to create list item, and then set its forecolor.   Thanks in advance for any help.  

 

Jason
Top achievements
Rank 1
 answered on 25 Jul 2017
1 answer
93 views

Hi

How can I stop the Label1 disappearing on OnTextChanged?

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="Textbox1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Label1"/>
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
    <Windows>
    <telerik:RadWindow ID="RadWindow1" runat="server">
        <ContentTemplate>
            <asp:Panel ID="Panel1" runat="server">
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        <telerik:RadTextBox runat="server" ID="Textbox1" OnTextChanged="Textbox1_TextChanged" AutoPostBack="True"></telerik:RadTextBox>
            </asp:Panel>
        </ContentTemplate>
    </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
 
    protected void Textbox1_TextChanged(object sender, EventArgs e)
    {
        if (sender is RadTextBox)
        {
            RadTextBox tb = (RadTextBox)sender;
            string message = "<strong>OnTextChanged</strong> event fired: Value has changed to: <em>\"" + (sender as RadTextBox).Text + "\"</em>";
            Label1.Text = message;
        }
    }

 

 

Thankyou

Andy

 

 

 

Vessy
Telerik team
 answered on 25 Jul 2017
7 answers
481 views

Hello,

I have two grids with EditMode="Batch".  Both grids subscribe to the OnBatchEditCommand event for saving data.  I am trying to save data from both of these grids, as well as data from other controls on the page with one button click. 

I have tried suggestions from http://www.telerik.com/forums/save-radgrid-in-batcheditmode-from-external-button and http://www.telerik.com/forums/how-do-i-save-2-radgrids-by-only-1-outside-button but can't seem to achieve the desired functionality...  Is this possible?

Thank you in advance.

Amy

 

Kathleen Johnson
Top achievements
Rank 1
 answered on 25 Jul 2017
2 answers
304 views

i am running sharepoint 2013 in a dev environment. when i restart the application server, all of my web applications show a 505 error. when i look in the web config of each web application i see the following. once i remove or comment out one of the lines, my web applications work fine until i restart the application server, then the second entry is re added to the web config of each of the web applications

<add name="Telerik.Web.UI.WebResource.axd_*" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2015.1.225.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode" />
      <add name="Telerik.Web.UI.WebResource.axd_*" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2015.2.624.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode" />

Robert
Top achievements
Rank 1
 answered on 25 Jul 2017
1 answer
74 views

I'm trying to find the best way to configure my radgrid to accomplish this scenario.

Here is the scenario:

(This all occurs within my Default.aspx page)

1. A radtextbox control prompts the user to input the customer number.  The customer number is validated using data coming from a table adapter.

 

2. I want to pass the customer number entered above into another query (table adapter) and return a item details dataset using it.  This is the dataset

that I want my RadGrid connected to. 

-------------------

I have been able to figure out how to accomplish everything above by using the RadGrid (onneeddatasource) event. 

Here is where my problem comes in:

---------------------

3.  One of the columns in my item details dataset (column name PRINT) is a Boolean datatype.   I have set the PRINT column in my datatable associated with the table adapter to read-only = false.  I need to give the user ability to (check or un-check) that column in my RadGrid and have it update the datatable only.  I have no requirement to go back and update the SQL database with the updated datatable.   This data is going to be used to generate a sql report which is included in this project.  

In summary, I haven't been able to find a way to query and store results in a local datatable and allow the radgrid to update that local datatable.  I've looked at the batch editing capability, but I don't like the way it requires having to press the save button in between paging.  I'd like to code it so that the user can click the check box and it immediately saves the result to the data table.  

Is there anyone out there that can give me some advice or an example of how I can accomplish this problem?

 

Marin Bratanov
Telerik team
 answered on 25 Jul 2017
0 answers
268 views
Hi all,

I would like to show events for more than one day in timeline view with horizontal time slots.
I found a solution to show multiple days in timeline view from the following link:
http://www.telerik.com/support/code-library/view-with-custom-date-range-and-swipe-support

But, time slots are showing in vertically. I want to show horizontally.
Time slots for two days are showing in my scheduler timeline, but events are not showing.
Telerik is not supporting this feature or any way to do it.

I attached image of my scheduler timeline with two days.

Thanks,
Lin
Lin
Top achievements
Rank 1
 asked on 25 Jul 2017
0 answers
115 views

Hi,

I am trying to add a custom filter option under default filter, in my grid there are two columns will use default filter, and others will be under FilterTemplate

1. newly added custom filter option called "Large Losses" will be added to both of columns filter. I donot want. (I used js to invisible the one). 

2. my Large Losses custom option is working with expression. but the issue is that after my Large Losses option is applied to the grid, I apply another filter option to the grid from another column, the Large Losses filter is gone, only the one applied after it shown in the grid. The other way around, If I apply other filter option first, then apply my Large Losses on top of it, it works fine, both filter result under AND shown in the grid.

3. Please help, while I debugging the code, found that my Large Losses expression is not kept when I apply another filter on top of it.

 

aspx:

<telerik:GridNumericColumn UniqueName="totalincurred" HeaderText="Incurred" DataField="totalincurred" Aggregate="Sum"  
                        AllowFiltering="true" DataType="System.Decimal" FilterControlWidth="80px" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right"   FooterStyle-HorizontalAlign="Right" DataFormatString="{0:N}">
 </telerik:GridNumericColumn>

 

C#:

   protected void LossesGrid_Init(object sender, EventArgs e)
        {
            GridFilterMenu filterMenu = LossesGrid.FilterMenu;
            RadMenuItem menuItem = new RadMenuItem();
            menuItem.Text = "Large Losses";
            menuItem.Value = "LargeLosses";
            LossesGrid.FilterMenu.Items.Add(menuItem);

            filterMenu.ItemClick += new RadMenuEventHandler(filterMenu_ItemClick);

}

   protected void filterMenu_ItemClick(object sender, RadMenuEventArgs e)
        {
            GridFilteringItem filterItem = LossesGrid.MasterTableView.GetItems(GridItemType.FilteringItem)[0] as GridFilteringItem;
            filterItem.FireCommandEvent("Filter", new Pair(e.Item.Value, e.Item.Attributes["totalincurred"]));
        }

 

 protected void LossesGrid_ItemCommand(object sender, GridCommandEventArgs e)
 {

 if (e.CommandName == RadGrid.FilterCommandName)
            {
                AOId = (this.Master as Main).AccountOverviewId;
                VersionNo = (this.Master as Main).VersionNumber();
           
                Pair filterPair = (Pair)e.CommandArgument;
             
                if (filterPair.First.ToString() == "LargeLosses")
                {
                    e.Canceled = true;
                    string newFilter = "(totalincurred >= 25000)";

                    if (LossesGrid.MasterTableView.FilterExpression == "")
                    {
                        LossesGrid.MasterTableView.FilterExpression = newFilter;
                    }
                    else
                    {
                        LossesGrid.MasterTableView.FilterExpression = "((" + LossesGrid.MasterTableView.FilterExpression + ") AND (" + newFilter + "))";
                    }
              
                   LossesGrid.Rebind();
                }
            }         

}

Li
Top achievements
Rank 1
 asked on 24 Jul 2017
5 answers
219 views
Support,

I have my website in a Visual Studio 2012 solution. 

When I enter debugging for my website, I am able to watch the .mp4 on the localhost page when I click play.

When I publish and deploy the website the RadMediaPlayer just circles when I hit play.

Any idea on what could cause RadMediaPlayer to just circle when published?

Thanks,

Max


Edit:
The only things I can I can think of is permissions or IIS settings
Stephen
Top achievements
Rank 1
 answered on 24 Jul 2017
6 answers
2.1K+ views
I have a RadTimePicker in my asp.net application as below.

<telerik:RadTimePicker ID="RCFromTime" runat="server" Width="110px" Culture="en-US" TimeView-TimeFormat="t" DateInput-DateFormat="h:mm tt" DateInput-DisplayDateFormat="h:mm tt" >
         
         <TimeView StartTime="08:00:00" EndTime="20:00:00" Height="100px" Width="250px" ShowHeader="False" runat="server"> </TimeView>
          <DateInput ID="DateInput1" runat="server">
                            <ClientEvents OnLoad="onLoadRadTimePicker1" />
          </DateInput>
</telerik:RadTimePicker>

In the program I am trying to move a time from sql server to the Timepicker to display the time saved as below.

RCFromTime.DbSelectedDate = phoneenq.Ph_Apptime;

I am getting an error on the above statement as " Value of '01-01-1900 08:00:00' is not valid for 'SelectedDate'. 'SelectedDate' should be between 'MinDate' and 'MaxDate'.Parameter name: SelectedDate"

(  Ph_Apptime is declared as -->public DateTime Ph_Apptime { get; set; }  inside the program)

Anyone please help me on this.





Eddy Mix
Top achievements
Rank 1
 answered on 24 Jul 2017
8 answers
1.7K+ views
Hello,
I have a custom button in my grid. After clicking on the button I want the LayoutID and LayoutTypeID read from the grid TemplateColumn. I've tried the following:
<Columns>
    <telerik:GridBoundColumn DataField="PlayerLayoutID" DataType="System.Int64"
        FilterControlAltText="Filter PlayerLayoutID column" HeaderText="PlayerLayoutID"
        ReadOnly="True" SortExpression="PlayerLayoutID"
        UniqueName="PlayerLayoutID" Visible="False">
    </telerik:GridBoundColumn>
    <telerik:GridTemplateColumn DataField="LayoutTypeID"
        FilterControlAltText="Filter LayoutTypeID column" HeaderText="Layout Type"
        UniqueName="LayoutTypeID">
        <EditItemTemplate>
            <telerik:RadComboBox ID="LayoutTypeIDRadComboBox" runat="server"
                DataSourceID="ODSLayoutTypes"
                DataTextField="TypeName"
                DataValueField="TypeID"
                onselectedindexchanged="LayoutTypeIDRadComboBox_SelectedIndexChanged"
                AutoPostBack="True"
                SelectedValue='<%# Bind("LayoutTypeID") %>' Culture="de-DE">
                <Items>
                    <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1"
                        Value="RadComboBoxItem1" />
                </Items>
            </telerik:RadComboBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidatorLayoutType"
                runat="server" ErrorMessage="*"
                ControlToValidate="LayoutTypeIDRadComboBox" Display="Dynamic"></asp:RequiredFieldValidator>
            <asp:CustomValidator ID="CustomValidatorLayoutType" runat="server" ErrorMessage="*"
                ControlToValidate="LayoutTypeIDRadComboBox" Display="Dynamic"
                onservervalidate="CustomValidatorLayoutType_ServerValidate" ></asp:CustomValidator>
        </EditItemTemplate>
        <ItemTemplate>
            <asp:Label ID="LayoutTypeIDLabel" runat="server"
                Text='<%# Eval("TypeName") %>'></asp:Label>
        </ItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridTemplateColumn DataField="LayoutID"
        FilterControlAltText="Filter column1 column" HeaderText="Layout"
        UniqueName="LayoutID">
        <EditItemTemplate>
            <telerik:RadComboBox ID="LayoutIDRadComboBox"
                runat="server" Culture="de-DE" Width="300px" Height="300px"
                OnClientDropDownOpened="OnClientDropDownOpenedHandler"
                ExpandAnimation-Type="None" CollapseAnimation-Type="None"
                <ItemTemplate>
                    <div id="div1" onclick="StopPropagation(event);">
                        <telerik:RadTreeView ID="RTVLayouts"
                            runat="server"                                                                     
                            onnodedatabound="RTVLayouts_NodeDataBound"
                            OnClientNodeClicking="nodeClicking" >
                        </telerik:RadTreeView>
                    </div>
                </ItemTemplate>
                <Items>
                    <telerik:RadComboBoxItem Text="" />
                </Items>                                                   
            </telerik:RadComboBox>
        </EditItemTemplate>
        <ItemTemplate>
            <asp:Label ID="LayoutIDLabel" runat="server" Text='<%# Eval("LayoutName") %>'></asp:Label>
        </ItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridEditCommandColumn ButtonType="ImageButton"
    FilterControlAltText="Filter EditCommandColumn column"
    HeaderText="<%$ Resources:BasicSettings, Edit %>">
</telerik:GridEditCommandColumn>
<telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete"
    ConfirmText="<%$ Resources:BasicSettings, ConfirmDelete %>"
    HeaderText="<%$ Resources:BasicSettings, Delete %>" Text="Delete"
    UniqueName="DeleteColumn">
</telerik:GridButtonColumn>
    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="makeObjects"
        FilterControlAltText="Filter MakeObjects column" HeaderText="Objects"
        ImageUrl="../images/symbols/settings_16.png" Text="Objects"
        UniqueName="MakeObjects">
    </telerik:GridButtonColumn>
</Columns>
protected void RadGridPlayerLayout_ItemCommand(object sender, GridCommandEventArgs e)
{
    ...
    if (e.CommandName == "makeObjects")
    {
        GridDataItem item = (GridDataItem)e.Item;
        string test = item["LayoutTypeID"].Text;
         
    }
}

Unfortunately that did not work. How can i solve this?

Best regards
Reiner

Swati
Top achievements
Rank 1
 answered on 24 Jul 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?