Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
614 views
Hi! I want to change color of text in each grid row, based on a datakey value. It works fine in all columns but for the text in gridHyperLinkColumn. What to do? I have a custom skin defined on the grid, and this is what I do in code behind. Please can you help me?
void GridMyTasks_ItemCreated(object sender, GridItemEventArgs e)  
        {  
            try 
            {  
                if ((e.Item.ItemType == GridItemType.Item) || (e.Item.ItemType == GridItemType.AlternatingItem))  
                {  
                    if (e.Item.DataItem != null)  
                    {  
                        string dueDate = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ActivityDueDate"].ToString().Trim();  
                        if (dueDate != "")  
                        {                              
                            DateTime date = Convert.ToDateTime(dueDate);  
                            if (date<DateTime.Today)  
                            {                                  
                                e.Item.ForeColor = System.Drawing.Color.Red;  
                            }  
                            else if (date < DateTime.Today.AddDays(10))  
                            {                                  
                                e.Item.ForeColor = System.Drawing.Color.Orange;  
                            }  
                        }  
                    }  
                }  
 
            }  
            catch (Exception ex)  
            {  
                ShowLabel(ex);  
            }  
        } 
Thanks,
Ana
Des
Top achievements
Rank 2
 answered on 05 Nov 2009
1 answer
247 views
having trouble setting the value of a GridDropDownColumn in a RadGrid detail table. Following the code at:

http://www.telerik.com/help/aspnet-ajax/grdcustomizeconfiguregriddropdowncolumn.html

my source code is as follows:

ASPX

<%@ Page Title="" Language="C#" MasterPageFile="~/admin.Master" AutoEventWireup="true" 
    CodeBehind="regions2.aspx.cs" Inherits="CRD.EAUtilitiesAdmin.regions2" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"
    <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" 
        AutoGenerateColumns="False" DataSourceID="ldsRegions" GridLines="None" OnItemDataBound="RadGrid1_ItemDataBound" 
        Skin="Office2007"
        <MasterTableView DataKeyNames="intRegionID" DataSourceID="ldsRegions" AllowAutomaticDeletes="True" 
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" CommandItemDisplay="TopAndBottom" 
            EditMode="InPlace" PageSize="20" Name="Regions"
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridBoundColumn DataField="intRegionID" DataType="System.Int32" HeaderText="ID" 
                    ReadOnly="True" SortExpression="intRegionID" UniqueName="intRegionID"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="strRegion" HeaderText="Region" SortExpression="strRegion" 
                    UniqueName="strRegion"
                </telerik:GridBoundColumn> 
                <telerik:GridDropDownColumn DataField="intSuperRegionID" DataSourceID="ldsSuperRegions" 
                    HeaderText="Super Region" ListTextField="strSuperRegion" ListValueField="intSuperRegionID" 
                    UniqueName="dd_SuperRegions"
                </telerik:GridDropDownColumn> 
                <telerik:GridEditCommandColumn UniqueName="EditCommand1" EditText="Edit Record" ButtonType="LinkButton"
                </telerik:GridEditCommandColumn> 
                <telerik:GridButtonColumn CommandName="delete" Text="delete record" UniqueName="DeleteColumn1" 
                    ConfirmText="Delete this Record?"
                </telerik:GridButtonColumn> 
            </Columns> 
            <DetailTables> 
                <telerik:GridTableView DataKeyNames="intChargeSources_X_Regions" DataSourceID="ldsRegions_X_ChargeSources" 
                    runat="server" CommandItemDisplay="Bottom" Name="ChargeSources_X_Regions" AllowAutomaticDeletes="True" 
                    AllowAutomaticInserts="True" AllowAutomaticUpdates="True" EditMode="InPlace" 
                    CommandItemSettings-AddNewRecordText="Add child record" Width="100%"
                    <ParentTableRelation> 
                        <telerik:GridRelationFields DetailKeyField="intRegionID" MasterKeyField="intRegionID" /> 
                    </ParentTableRelation> 
                    <Columns> 
                        <telerik:GridDropDownColumn DataSourceID="ldsRegions" UniqueName="dd_Regions" SortExpression="strRegion" 
                            HeaderText="Region" ListTextField="strRegion" ListValueField="intRegionID" DataField="intRegionID"
                        </telerik:GridDropDownColumn> 
                        <telerik:GridDropDownColumn DataSourceID="ldsChargeSources" UniqueName="dd_ChargeSources" 
                            SortExpression="strChargeSource" HeaderText="Charge Source" ListTextField="strChargeSource" 
                            ListValueField="intChargeSourceID" DataField="intChargeSourceID"
                        </telerik:GridDropDownColumn> 
                        <telerik:GridEditCommandColumn UniqueName="EditCommand2" EditText="Edit child record" 
                            ButtonType="LinkButton"
                        </telerik:GridEditCommandColumn> 
                        <telerik:GridButtonColumn CommandName="delete" Text="delete child record" UniqueName="DeleteColumn2" 
                            ConfirmText="Delete this Record?"
                        </telerik:GridButtonColumn> 
                    </Columns> 
                </telerik:GridTableView> 
            </DetailTables> 
        </MasterTableView> 
    </telerik:RadGrid> 
    <asp:LinqDataSource ID="ldsRegions" runat="server" ContextTypeName="CRD.EAUtilitiesAdmin.data.dbEAUtilitiesDataContext" 
        EnableDelete="True" EnableInsert="True" EnableUpdate="True" OrderBy="strRegion" 
        TableName="tblRegions"
    </asp:LinqDataSource> 
    <asp:LinqDataSource ID="ldsSuperRegions" runat="server" ContextTypeName="CRD.EAUtilitiesAdmin.data.dbEAUtilitiesDataContext" 
        OrderBy="strSuperRegion" TableName="tblSuperRegions"
    </asp:LinqDataSource> 
    <asp:LinqDataSource ID="ldsRegions_X_ChargeSources" runat="server" ContextTypeName="CRD.EAUtilitiesAdmin.data.dbEAUtilitiesDataContext" 
        EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="tblChargeSources_X_tblRegions" 
        Where="intRegionID == @intRegionID"
        <WhereParameters> 
            <asp:ControlParameter ControlID="RadGrid1" Name="intRegionID" PropertyName="SelectedValue" 
                Type="Int32" /> 
        </WhereParameters> 
    </asp:LinqDataSource> 
    <asp:LinqDataSource ID="ldsChargeSources" runat="server" ContextTypeName="CRD.EAUtilitiesAdmin.data.dbEAUtilitiesDataContext" 
        OrderBy="strChargeSource" TableName="tblChargeSources"
    </asp:LinqDataSource> 
</asp:Content> 
 

DOT CS
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
 
using Telerik.Web.UI; 
 
namespace CRD.EAUtilitiesAdmin 
    public partial class regions2 : System.Web.UI.Page 
    { 
        protected void Page_Load(object sender, EventArgs e) 
        { 
 
        } 
 
        protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
        { 
            // if you are inserting or updating a record in a child table, force the region drop down to display the region of the parent record 
            if ((e.Item is GridEditableItem && ((GridEditableItem)e.Item).IsInEditMode)) 
            { 
                if ((e.Item.OwnerTableView.Name.ToString() == "ChargeSources_X_Regions")) 
                { 
                    GridEditableItem editItem = (GridEditableItem)e.Item; 
                    GridEditManager editMan = editItem.EditManager; 
 
                    GridDropDownListColumnEditor editor = (GridDropDownListColumnEditor)editMan.GetColumnEditor("dd_Regions"); 
 
                    //in case you have RadComboBox editor for the GridDropDownColumn (this is the default editor), 
                    //you will need to use ComboBoxControl below instead of DropDownListControl 
                    //Then you can modify the list control as per your custom conventions 
 
                    GridDataItem parentItem = (GridDataItem)e.Item.OwnerTableView.ParentItem; 
 
                    editor.DropDownListControl.SelectedValue = parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["intRegionID"].ToString(); 
 
                    ////tried direct casting the DropDownList (below) but still came back empty 
                    //DropDownList ddList = editor.DropDownListControl; 
                    //ddList.Items.Insert(0, new ListItem("ddd","0")); 
                    //ddList.SelectedIndex = 3
                } 
            } 
        } 
    } 
 

Basically what I want: When user expands a region and clicks on "Add child record" (to add a child record to that region), the dd_Regions drop down column is automatically set to the value of the parent record.

when i debug, and step through the RadGrid1_ItemDataBound method, the parentItem variable is populated correctly, and has the ID that I am expecting. But editor.DropDownListControl comes back empty (Items.Count = 0). direct casting to a DropDownList returns the same (empty count).

Any help appreciated!

thanks in advance

/jonathan


Tsvetoslav
Telerik team
 answered on 05 Nov 2009
2 answers
489 views
Hi Telerik Guys !

It wolud be extreme pleasure , if you could please help me sort out the problem that I have been facing during my project implementation.

Below is the brief summary of my problem :-

I have an USER CONTROL with my ASPX Page. With in that USER CONTROL, Im using TELERIK RAD UPLOAD CONTROL with in the UPDATE PANEL which allow me to upload any file at my UI(User Interface).

Now the problem actually lies here is that, I have used UPDATE PROGRESS with on my ASPX page.

Now when I browse or build my Page & do search for any result then UPDATE PROGRESS does not work .

Why is it so ?  While it been using across all the TABS which does not consist of any  TELERIK UPLOAD CONTROL. 


Please help.

Below is the code in ASPX PAGE :--

<asp:UpdatePanel runat="server" ID="TrialManagerUpdatePanel" UpdateMode="Conditional">
                    <ContentTemplate>
                <cc1:TabContainer ID="TrialHomeTabContainer" runat="server" ActiveTabIndex="0" Width="95%"
                    Style="margin: 20px 0px 20px 0px;" CssClass="ajax__tab_theme">
                    <cc1:TabPanel ID="TrialHomeGeneralTabPanel" runat="server" HeaderText="General">
                        <ContentTemplate>
                            <UC_Trial_General:UC_Trial_General ID="uc_trial_general1" runat="server" />
                        </ContentTemplate>
                    </cc1:TabPanel>
                    <cc1:TabPanel ID="SitesTabPanel" runat="server" HeaderText="Sites">
                        <ContentTemplate>
                            <UC_Trial_Sites:UC_Trial_Sites ID="uc_trial_sites1" runat="server" />
                        </ContentTemplate>
                    </cc1:TabPanel>
                    <cc1:TabPanel ID="ContactsTabPanel" runat="server" HeaderText="Contacts">
                        <ContentTemplate>
                            <UC_Trial_Contacts:UC_Trial_Contacts ID="uc_trial_contacts1" runat="server" />
                        </ContentTemplate>
                    </cc1:TabPanel>
                    <cc1:TabPanel ID="SponsorTabPanel" runat="server" HeaderText="Sponsor">
                        <ContentTemplate>
                            <UC_Trial_Sponsor:UC_Trial_Sponsor ID="uc_trial_sponsor1" runat="server" />
                        </ContentTemplate>
                    </cc1:TabPanel>
                    <cc1:TabPanel ID="EligibilityTabPanel" runat="server" HeaderText="Eligibility">
                        <ContentTemplate>
                            <table class="tableInnerSections" cellpadding="0" cellspacing="5">
                                <tr>
                                    <td colspan="3" align="right">
                                        <div class="divTopSectionTrialManager">
                                            <asp:Label ID="CTMSTrialIDLabel" runat="server" SkinID="TopHeader" Text="CTMS Trial ID :">
                                            </asp:Label>
                                            <asp:Label ID="TrialIDLabel" runat="server" SkinID="TopHeader"></asp:Label>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Label ID="ChooseEligibilityLabel" runat="server" Text="Choose Eligibility" SkinID="BlueHeadings"></asp:Label>
                                    </td>
                                    <td style="width: 87%; text-align: left;">
                                        <hr />
                                    </td>
                                </tr>
                            </table>
                            <asp:UpdatePanel runat="server" ID="EligibilityUpdatePanel">
                                <ContentTemplate>
                                    <cc1:TabContainer ID="EligibilityTabContainer" runat="server" ActiveTabIndex="0"
                                        Width="95%" Style="margin: 20px 0px 20px 0px;" CssClass="ajax__tab_theme">
                                        <cc1:TabPanel ID="CancerTypeStageTabPanel" runat="server" HeaderText="Cancer Type/Stage">
                                            <ContentTemplate>
                                                <UC_Trial_Eligibility_Cancer_Type_Stage:UC_Trial_Eligibility_Cancer_Type_Stage ID="uc_trial_eligibility__cancer_type_stage1"
                                                    runat="server" />
                                            </ContentTemplate>
                                        </cc1:TabPanel>
                                        <cc1:TabPanel ID="TreatmentTabPanel" runat="server" HeaderText="Treatment">
                                            <ContentTemplate>
                                                <UC_Trial_Eligibility_Treatment:UC_Trial_Eligibility_Treatment ID="uc_trial_eligibility_treatment1"
                                                    runat="server" />
                                            </ContentTemplate>
                                        </cc1:TabPanel>
                                        <cc1:TabPanel ID="AdvancedTabPanel" runat="server" HeaderText="Advanced">
                                            <ContentTemplate>
                                                <UC_Trial_Eligibility_Treatment_Advanced:UC_Trial_Eligibility_Treatment_Advanced
                                                    ID="uc_trial_eligibility_treatment_advanced1" runat="server" />
                                            </ContentTemplate>
                                        </cc1:TabPanel>
                                        <cc1:TabPanel ID="GeneralEligibilityCriteriaTabPanel" runat="server" HeaderText="General Eligibility Criteria">
                                            <ContentTemplate>
                                                <UC_Trial_Eligibility_General_Eligibility_Criteria:UC_Trial_Eligibility_General_Eligibility_Criteria
                                                    ID="uc_trial_eligibility_general_eligibility_criteria1" runat="server" />
                                            </ContentTemplate>
                                        </cc1:TabPanel>
                                    </cc1:TabContainer>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                            <asp:UpdateProgress ID="EligibilityUpdateProgress" runat="server" AssociatedUpdatePanelID="EligibilityUpdatePanel"
                                DisplayAfter="0">
                                <ProgressTemplate>
                                    <div id="progressBackgroundFilter">
                                    </div>
                                    <div id="processMessage">
                                        <img alt="Loading" src="../App_Themes/PANCAN_Theme/Images/ajax-loader.gif" style="width: 31px;
                                            height: 31px" /><br />
                                        <span class="updateProgress">Working on your request...</span>
                                        <br />
                                    </div>
                                </ProgressTemplate>
                            </asp:UpdateProgress>
                        </ContentTemplate>
                    </cc1:TabPanel>
                    <cc1:TabPanel ID="TherapeuticTabPanel" runat="server" HeaderText="Therapeutic">
                        <ContentTemplate>
                            <UC_Trial_Therapeutic:UC_Trial_Therapeutic ID="uc_trial_therapeutic1" runat="server" />
                        </ContentTemplate>
                    </cc1:TabPanel>
                    <cc1:TabPanel ID="NotesTabPanel" runat="server" HeaderText="Notes">
                        <ContentTemplate>
                            <UC_Trial_Notes:UC_Trial_Notes ID="uc_trial_notes1" runat="server" />
                        </ContentTemplate>
                    </cc1:TabPanel>
                    <cc1:TabPanel ID="StatusTabPanel" runat="server" HeaderText="Status">
                        <ContentTemplate>
                            <UC_Trial_Status:UC_Trial_Status ID="uc_trial_Status1" runat="server" />
                        </ContentTemplate>
                    </cc1:TabPanel>
                    <cc1:TabPanel ID="HistoryTabPanel" runat="server" HeaderText="History">
                        <ContentTemplate>
                            <UC_Trial_History:UC_Trial_History ID="uc_trial_history1" runat="server" />
                        </ContentTemplate>
                    </cc1:TabPanel>
                </cc1:TabContainer>
                </ContentTemplate>
                </asp:UpdatePanel>

 <asp:UpdateProgress ID="TrialManagerUpdateProgress" runat="server" AssociatedUpdatePanelID="TrialManagerUpdatePanel"
                    DisplayAfter="0">
                    <ProgressTemplate>
                        <div id="progressBackgroundFilter">
                        </div>
                        <div id="processMessage">
                            <img alt="Loading" src="../App_Themes/PANCAN_Theme/Images/ajax-loader.gif" style="width: 31px;
                                height: 31px" /><br />
                            <span class="updateProgress">Working on your request...</span>
                            <br />
                        </div>
                    </ProgressTemplate>
                </asp:UpdateProgress>

While code I using with the ASCX Page is following :

 <td valign="top" align="left">
            <asp:UpdatePanel ID="TrialNotesUploadUpdatePanel" runat="server">
                <ContentTemplate>
                    <telerik:RadUpload ID="AttachFileRadUpload" runat="server" AllowedFileExtensions=".doc,.docx,.xls,.xlsx,.txt,.msg"
                        ControlObjectsVisibility="None" ReadOnlyFileInputs="True" Skin="Default" TabIndex="4"
                        Enabled="False">
                        <Localization Select="Upload File" />
                    </telerik:RadUpload>
                </ContentTemplate>
                <Triggers>
                <asp:PostBackTrigger  ControlID="NewTrialNoteButton"/>
                </Triggers>
            </asp:UpdatePanel>
            <asp:Label ID="AttachFileExtensionsLabel" runat="server" SkinID="InnerLabel" Text="(Valid File Extensions :- .doc, .docx, .xls, .xlsx, .txt, .msg only)"
                EnableViewState="False"></asp:Label>
            <asp:CustomValidator ID="AttachFileCustomValidator" runat="server" Display="Dynamic"
                OnServerValidate="AttachFileCustomValidator_ServerValidate" ValidationGroup="SaveGroup"></asp:CustomValidator>
        </td>


mathieu cupryk
Top achievements
Rank 1
 answered on 05 Nov 2009
1 answer
190 views
Hi,

I am using radeditor (telerik version Q22009).

While exporting to pdf it givess me nothing . blank page.

For simple formatting it export the pdf properly.
But when i used the formatted data in radeditor and while exporting it goes blank.
How can i solve this issue.

I have attached the screen shot of radeditor content

Thanks
Rumen
Telerik team
 answered on 05 Nov 2009
4 answers
96 views

I have a hierarchal grid with two levels (master and details).  When a master level record is expanded all detail records are automatically put into Edit mode.  As the user tabs through each detail record I would like to save their work automatically (no mouse clicks, no enter key).  When the user exits the row the record is saved.  

This is going to be a high speed data entry application and mgt does not even want to display the update/cancle buttons on each detail record.

 What would be the best method for achieving this?

Iana Tsolova
Telerik team
 answered on 05 Nov 2009
1 answer
199 views
If I have a RADGrid, such as:

        <telerik:RadGrid runat="server" ID="radGrid" PageSize="25" 
            AllowPaging="true"  
            AllowSorting="true"  
            AutoGenerateColumns="false" > 
            <PagerStyle Mode="NextPrevNumericAndAdvanced" /> 
            <MasterTableView> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="ItemNumber" HeaderText="Item number" AllowSorting="true"  /> 
                    <telerik:GridBoundColumn DataField="Name" HeaderText="Name" /> 
                    <telerik:GridBoundColumn DataField="ShortDescription" HeaderText="Description" /> 
                    <telerik:GridBoundColumn DataField="Price" HeaderText="Price" /> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 

What is the preferred way to localize the HeaderText values ? (Say, if the page is being shown in the Danish culture, I would like to display the danish names as column headers, instead of english ones).

I possible, I would like to do this in the markup. I already have a helper method such as:
HeaderText="<%= Translate.Text("ItemNumber") %>" 

But if I try to do this on a Column, I get a parser error: "Literal content ('<telerik:GridBoundColumn DataField="ItemNumber" HeaderText="') is not allowed within a 'Telerik.Web.UI.GridColumnCollection'."
Shinu
Top achievements
Rank 2
 answered on 05 Nov 2009
4 answers
206 views
How to scroll to top of editor programatically?
I have several long documents. 
After scroll to bottom of first document, I load the second document, the editor position remain at the bottom.
How do I bring it back up to the top?

Thanks. 
Rumen
Telerik team
 answered on 05 Nov 2009
1 answer
104 views
q2 2009

hiya,

I can't see any reason why you wouldn't explicitly disable viewstate for every control in a radGrid's editTemplate in the demos.
Let me know if there is a good reason, otherwise, disable  it in your demos, the performance will benefit.

If this helps,  you know who to credit the points to....

yogi




Mira
Telerik team
 answered on 05 Nov 2009
1 answer
90 views
Hi,
     Please could you tell me if the fitlering buttons are customizable (i.e. can you just show a subset of them and can you rename the options)

Thanx

Robert Smith

Shinu
Top achievements
Rank 2
 answered on 05 Nov 2009
3 answers
164 views
Hello!

I have an ASP.NET-Button shipped with VS. This button is responsible for saving the data the user enters in the form. When the Page is loaded, the button should be disabled. Then I have other controls (standard VS controls), where I have "linked" the client-side onpropertychange() event. When a user for example fills out a javascript-enabled textbox, the javascript-function will enable the Save-Button. Everything is fine.

When I now - for example - use RadTextBox and link the ClientEvents-OnValueChanged with the same javascript-function, the page loads and I can see, that the Save-Button is automatically enabled?!?

Is it possible, that RadControls do not fire javascript-events on Page_Load? Are there any workarounds?

Bye

Michael
Nikolay Rusev
Telerik team
 answered on 05 Nov 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?