Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
2.2K+ views
HI Guys,

How do I go about changing a RadGrid cell color based on a database flag?

William
Peytton
Top achievements
Rank 1
 answered on 28 Oct 2015
1 answer
87 views

I have a RadPanelBar inside of a RadAjaxPanel. When an item is clicked on the RadPanelBar, I dynamically load a user control that uses a ModalPopupExtender. After a button is clicked on the user control and it causes a postback, everything works as intended and I can click another item on the RadPanelBar and everything works. When the user control is closed by the CancelControlID property of the ModalPopupExtender however, it doesn't cause a postback and the next time I click an item on the RadPanelBar, the RadAjaxLoadingPanel persists.

 

What the page looks like on load before any clicks: http://i.imgur.com/drnCcNO.png

What the rad panel bar looks after click on an item: http://i.imgur.com/czikveQ.png

Modal Control is loaded: http://i.imgur.com/rDT07Yw.png

After Modal control is closed without causing a postback, when clicking on an item in RadPanelBar again, it seems to be even more dim: http://imgur.com/YZNmRpM

 Now when user control is loaded again, the loading panel persists: http://i.imgur.com/TAXnRH4.png

Maria Ilieva
Telerik team
 answered on 28 Oct 2015
0 answers
68 views

We are using telerik old version which was using dll of rad controls.Now we are upgrading these controls to latest version of telerik and getting  skin's defined name issue i.e.previously which skin is used after updating dll it shows error skin name(exp. Skin="Arrows/3DBlueAppt" ) does not exits. 

My following code is not working , So please let us know How we can fixed this issue.

on aspx page:

<telerik:RadTreeView ID="rtvTopTreeview" Skin="Arrows/3DBlueAppt"  AutoPostBackOnCheck="False"
                                                                                                AfterClientCheck="AfterCheck" CheckBoxes="true" runat="server" AutoPostBack="True"
                                                                                                OnNodeClick="rtvTopTreeview_NodeClick">
</telerik:RadTreeView>

On .cs page:

rtvTopTreeview.imagesBaseDir= "~/RadControls/TreeView/Skins/Arrows/3DBlueAppt";​              

 

also it shows error that rtvTopTreeview does not contain a definition of imagesBaseDir.

 

please help .

ashishpandey21jan
Top achievements
Rank 1
 asked on 28 Oct 2015
1 answer
58 views

I am just getting started with learning the Telerik products and I see there is info on Radgrid for ASP.net AJAX which indicates it is the newest version.  How can I tell which version I am using so I don't waist my time reading documentation on the wrong product.

 

Thanks

Perry

Pavlina
Telerik team
 answered on 28 Oct 2015
10 answers
1.2K+ views
Hello,

I'm having a problem with custom skins for most controls (only confirmed this with combobox and input so far) - the css I specify for them are being overridden by css from the WebResource.

May I know what things I might have done wrong / things I might be missing?

Please see attached - screenshot of IE8 dev toolbar showing the styles overridden.

Thanks!
~xhrei
Ivan Zhekov
Telerik team
 answered on 27 Oct 2015
0 answers
148 views

How do I control a RadButton's visibility state from the codebehind?

For example, if a user is not yet logged-in, then I want to hide the logout button.

Matt
Top achievements
Rank 1
 asked on 27 Oct 2015
2 answers
254 views

Hi - I've been searching for a way to do this but haven't found the "correct" way.

 

I have a RadGrid - on it are multiple RadNumericTextBox columns - one of those columns is txtQTY.

 In the save form logic I need to get the value of that column from each of the records in the rad grid to build a table of values to pass to the database.  All that worked fine back in VS 2003.  I did the following back then:

 double X

x = ((RadNumericTextBox)(this.raddgActivityGroup.Items[i]).FindControl("txtQTY")).Value;

 But in this version VS 2013 and newest telerik AJAX controls - I get the following problem:

Error 271 Cannot implicitly convert type 'double?' to 'double'. An explicit conversion exists (are you missing a cast?) 

I can get rid of the problem by changing the line to read:

 x = ((RadNumericTextBox)(this.raddgActivityGroup.Items[i]).FindControl("txtQTY")).Value.Value;

but I have no idea why that works and am very concerned that I might be breaking something.

 

HELP!?!?

 

Thanks

Cory

Cory
Top achievements
Rank 1
 answered on 27 Oct 2015
1 answer
110 views

I'm following the tutorial here to do some conditional styling on a radGrid.

http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/appearance-and-styling/conditional-formatting

But I am not able to use this:

dataBoundItem["Approved"].ForeColor = Color.Red;

 The visual studio message is "Unknown entity 'color'

and the display error message is:

"Compiler Error Message: CS0103: The name 'Color' does not exist in the current context"

What am I missing? Thanks!

 

Konstantin Dikov
Telerik team
 answered on 27 Oct 2015
1 answer
84 views

Hi I have an issue with 'Paste from Word' option of telerik Editor. When i copy some text from MSWord and paste it in the editor using 'Paste from Word'  option, the indentation of  some lines changes. I also tried this on Telerik's demo site:
http://demos.telerik.com/aspnet-ajax/editor/examples/cleaningwordformatting/defaultcs.aspx

and the issue is present there as well. I have attached  original document and the screenshot of the changed indentation after using 'Paste from Word'.

I have tried this on IE and Chrome as well and the issue occurs on both.

Please look  into it as this changes the text to an unacceptable format.

 

Thanks

Marin Bratanov
Telerik team
 answered on 27 Oct 2015
3 answers
707 views
I'm having a problem with using a popup edit form with a RadGrid.

We are in a completely disconnected environment - all data is retrieved and updated through a WCF web service and in general is returned as LLBLGen entities/EntityCollection(s).  Nearly everything about this setup works (initial grid display, viewing the edit form in read-only, updating the database, etc.).  All database functionality is working great - the code-behind commands fire fine and the data in the database is inserted/updated.  The grid refreshes fine after inserts/updates as well, however, when performing an insert the popup editor stays on the screen and I get a javascript error:

"Insert item is available only when grid is in insert mode". 

When I run in debug mode, it's not throwing the error anywhere in code-behind, but somewhere in all the auto-generated ajax javascript, so I can't tell what exactly is causing the error.

ASPX:

<telerik:RadGrid ID="RadGrid1" runat="server"  
    AutoGenerateColumns="false" 
    AllowPaging="true" 
    AllowAutomaticInserts="false" 
    AllowAutomaticDeletes="false" 
    AllowAutomaticUpdates="false" 
    OnItemDataBound="RadGrid1_ItemDataBound" 
    OnNeedDataSource="RadGrid1_NeedDataSource" 
    OnInsertCommand="RadGrid1_InsertCommand" 
    OnUpdateCommand="RadGrid1_UpdateCommand" 
    OnPreRender="RadGrid1_PreRender" 
> 
    <MasterTableView  
        EditMode="PopUp"  
        CommandItemDisplay="Top"  
        DataKeyNames="NoteID"  
    > 
        <EditFormSettings InsertCaption="Add new Note" /> 
        <Columns> 
            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton" HeaderStyle-Width="35px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" /> 
            <telerik:GridBoundColumn DataField="NoteID" UniqueName="NoteID" Visible="false" /> 
            <telerik:GridTemplateColumn HeaderText="!" UniqueName="Important" HeaderStyle-Font-Bold="true" HeaderStyle-Width="10px"
                <ItemTemplate> 
                    <asp:Label ID="lblImportant" runat="server" ForeColor="Red" Text='<%# (bool)Eval("Important")  ? "!" : "" %>' ToolTip="Note is marked as important" Font-Bold="true" /> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn> 
            <telerik:GridBoundColumn HeaderText="Type" DataField="NoteType" UniqueName="NoteType" DataType="System.String" ItemStyle-Wrap="false" HeaderStyle-Width="110px" /> 
            <telerik:GridBoundColumn HeaderText="Recorded By" DataField="RecordedBy" UniqueName="RecordedBy" DataType="System.String" ReadOnly="true" HeaderStyle-Wrap="false" HeaderStyle-Width="120px" ItemStyle-Wrap="false" /> 
            <telerik:GridBoundColumn HeaderText="Date Created" DataField="ServerDate" UniqueName="ServerDate" DataType="System.DateTime" HeaderStyle-Wrap="false" HeaderStyle-Width="140px" ItemStyle-Wrap="true" /> 
            <telerik:GridBoundColumn HeaderText="Subject" DataField="SubjectSummary" UniqueName="SubjectSummary" DataType="System.String" /> 
        </Columns> 
        <EditFormSettings InsertCaption="Add new Note" CaptionFormatString="Edit Note" CaptionDataField="NoteID" EditFormType="Template"
            <FormTemplate> 
                <table cellpadding="4" cellspacing="0" width="100%" border="0"
                    <tr> 
                        <td style="width: 10px; white-space: nowrap; font-weight: bold;">Recorded By:</td> 
                        <td> 
                            <asp:Label ID="lblRecordedBy" runat="server" Text='<%# Bind("RecordedBy") %>' /> 
                        </td> 
                        <td style="font-weight: bold;">on</td> 
                        <td> 
                            <asp:Label ID="lblServerDate" runat="server" Text='<%# Bind("ServerDate") %>' /> 
                        </td> 
                        <td style="width: 10px; font-weight: bold;">Type:</td> 
                        <td style="width: 114px;"
                            <telerik:RadComboBox ID="cboType" runat="server" SkinID="RadCombo" Width="110px" /> 
                        </td> 
                    </tr> 
                </table> 
                <table cellpadding="4" cellspacing="0" width="100%" border="0"
                    <tr> 
                        <td style="width: 40px; font-weight: bold;">Subject:</td> 
                        <td colspan="3"
                            <telerik:RadTextBox ID="txtSubject" runat="server"  
                                SkinID="RadTextBoxDefault" 
                                Text='<%# DataBinder.Eval(Container.DataItem, "Subject") %>' 
                                Width="100%" 
                            /> 
                        </td> 
                        <td style="width: 40px; font-weight: bold;">Important?</td> 
                        <td style="width: 10px;"><asp:CheckBox ID="chkImportant" runat="server" Checked='<%# (Container is GridEditFormInsertItem) ? false : Eval("Important") %>' /></td
                    </tr> 
                    <tr> 
                        <td colspan="100%" valign="top" align="left"
                            <telerik:RadEditor ID="radEditor_Note" runat="server" 
                                 Width="100%" 
                                 Height="250px" 
                                 Content='<%# DataBinder.Eval(Container.DataItem, "Note") %>' 
                                 AutoResizeHeight="true" 
                                 EditModes="Design" 
                                 ToolbarMode="Default" 
                             > 
                                <Tools> 
                                    <telerik:EditorToolGroup> 
                                        <telerik:EditorTool Name="Bold" /> 
                                        <telerik:EditorTool Name="Italic" /> 
                                        <telerik:EditorTool Name="Underline" /> 
                                        <telerik:EditorSeparator /> 
                                        <telerik:EditorTool Name="JustifyLeft" /> 
                                        <telerik:EditorTool Name="JustifyCenter" /> 
                                        <telerik:EditorTool Name="JustifyRight" /> 
                                        <telerik:EditorSeparator /> 
                                        <telerik:EditorTool Name="AjaxSpellCheck" /> 
                                        <telerik:EditorSeparator /> 
                                        <telerik:EditorTool Name="ToggleScreenMode" /> 
                                    </telerik:EditorToolGroup> 
                                </Tools> 
                            </telerik:RadEditor> 
                        </td> 
                    </tr> 
                </table> 
                <table width="100%" style="margin-top: 10px;"
                    <tr> 
                        <td align="right" colspan="100%"
                            <asp:Button ID="btnUpdate" runat="server"  
                                Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' 
                                CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' 
                                SkinID="btnSearch" 
                                Visible='<%# (AllowAdd || AllowEdit) ? true : false %>' 
                             /> 
                            &nbsp; 
                            <asp:Button ID="btnCancel" runat="server" 
                                Text='<%# (AllowAdd || AllowEdit) ? "Cancel" : "Close" %>'  
                                CausesValidation="False" 
                                CommandName="Cancel" 
                                SkinID="btnSearch" 
                            /> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td colspan="100%"
                        </td> 
                    </tr> 
                </table> 
                <asp:Label ID="lblNoteTypeID" runat="server" Text='<%# Bind("NoteTypeID") %>' Visible="false" /> 
            </FormTemplate> 
        </EditFormSettings> 
    </MasterTableView> 
    <ClientSettings> 
        <ClientEvents OnRowDblClick="RowDblClick" OnPopUpShowing="PopUpShowing" /> 
        <Scrolling AllowScroll="true" /> 
    </ClientSettings> 
</telerik:RadGrid> 

And the code behind:

protected void RadGrid1_PreRender(object sender, EventArgs e) 
    // enable/disable command items based on security 
    foreach (GridCommandItem item in RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)) 
    { 
        if (!AllowAdd) 
        { 
            ((Button)item.FindControl("AddNewRecordButton")).Visible = false
            ((LinkButton)item.FindControl("InitInsertButton")).Visible = false
        } 
 
        ((LinkButton)item.FindControl("RebindGridButton")).Visible = false
        ((Button)item.FindControl("RefreshButton")).Visible = false
    } 
 
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
    LoadData(); 
 
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
    { 
        // get handles for the controls in the FormTemplate 
        GridEditableItem item = (GridEditableItem)e.Item; 
        Label lblNoteTypeID = item.FindControl("lblNoteTypeID"as Label; 
        Label lblRecordedBy = item.FindControl("lblRecordedBy"as Label; 
        Label lblServerDate = item.FindControl("lblServerDate"as Label; 
        RadComboBox cboType = item.FindControl("cboType"as RadComboBox; 
        RadTextBox txtSubject = item.FindControl("txtSubject"as RadTextBox; 
        CheckBox chkImportant = item.FindControl("chkImportant"as CheckBox; 
        RadEditor radEditor_Note = item.FindControl("radEditor_Note"as RadEditor; 
        Button btnUpdate = item.FindControl("btnUpdate"as Button; 
        Button btnCancel = item.FindControl("btnCancel"as Button; 
        string noteTypeID = lblNoteTypeID.Text; 
 
        // set the combo 
        switch (ForeignKeyType) 
        { 
            case ForeignKeyTypes.Branch: 
                bindComboToEnum(cboType, ListCategory.BranchNoteType); 
                break
 
            case ForeignKeyTypes.BranchProspect: 
                bindComboToEnum(cboType, ListCategory.BranchProspectNoteType); 
                break
 
            case ForeignKeyTypes.Recruit: 
                bindComboToEnum(cboType, ListCategory.RecruitNoteType); 
                break
 
            defaultbreak
        } 
 
        // Edit versus Insert logic 
        if (e.Item.OwnerTableView.IsItemInserted) 
        { 
            // insert mode 
            lblRecordedBy.Text = CurrentUser.FullName; 
            lblServerDate.Text = DateTime.Now.ToString(); 
        } 
        else 
        { 
            // edit mode 
            cboType.SelectedIndex = cboType.Items.IndexOf(cboType.Items.FindItemByValue(noteTypeID)); 
            cboType.Enabled = AllowEdit; 
            txtSubject.ReadOnly = !AllowEdit; 
            chkImportant.Enabled = AllowEdit; 
            radEditor_Note.Enabled = AllowEdit; 
            btnUpdate.Visible = AllowEdit; 
            btnCancel.Text = "Close"
        } 
    } 
    else if (e.Item is GridHeaderItem) 
    { 
        GridHeaderItem headerItem = e.Item as GridHeaderItem; 
        headerItem["EditCommandColumn"].Text = AllowEdit ? "Edit" : "View"
    } 
 
protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) 
    GridEditableItem item; 
    NoteEntity note; 
    int newNoteTypeID; 
    string msg = string.Empty; 
 
    item = e.Item as GridEditableItem; 
    newNoteTypeID = (item.FindControl("cboType"as RadComboBox).SelectedValue.ToInt(); 
    note = ServiceProxy.getService<INoteService>().Fetch(item.GetDataKeyValue("NoteID").ToString().ToInt(), FetchTypes.Heavy); 
 
    // update the note 
    note.Note = (item.FindControl("radEditor_Note"as RadEditor).Content; 
    note.Important = (item.FindControl("chkImportant"as CheckBox).Checked; 
    note.Subject = (item.FindControl("txtSubject"as RadTextBox).Text; 
 
    // update the note type 
    switch (ForeignKeyType) 
    { 
        case ForeignKeyTypes.Branch: 
            if (note.BranchNote != null
                note.BranchNote[0].BranchNoteTypeID = newNoteTypeID; 
            break
 
        case ForeignKeyTypes.BranchProspect: 
            if (note.BranchProspectNote != null
                note.BranchProspectNote[0].BranchProspectNoteTypeID = newNoteTypeID; 
            break
 
        case ForeignKeyTypes.Recruit: 
            if (note.RecruitApplicationNote != null && note.RecruitApplicationNote.Count > 0) 
                note.RecruitApplicationNote[0].RecruitNoteTypeID = newNoteTypeID; 
            break
 
        defaultbreak
    } 
 
    // perform the save 
    note = ServiceProxy.getService<IEntityService>().EntitySave(note) as NoteEntity; 
    msg = note.StatusMessage; 
 
    if (msg.Length > 0) 
    { 
        lblStatusMessage.Text = msg; 
        lblStatusMessage.ForeColor = System.Drawing.Color.Red; 
        ErrorHandler.Handle(new Exception(msg), Request); 
    } 
 
    e.Item.OwnerTableView.ClearEditItems(); 
    LoadData(true); 
// RadGrid1_UpdateCommand 
 
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e) 
    GridEditableItem item; 
    NoteEntity note; 
    int newNoteTypeID; 
    string msg = string.Empty; 
 
    item = e.Item.OwnerTableView.GetInsertItem() as GridEditableItem; 
    note = new NoteEntity(); 
 
    newNoteTypeID = (item.FindControl("cboType"as RadComboBox).SelectedValue.ToInt(); 
    note.Note = (item.FindControl("radEditor_Note"as RadEditor).Content; 
    note.Important = (item.FindControl("chkImportant"as CheckBox).Checked; 
    note.Subject = (item.FindControl("txtSubject"as RadTextBox).Text; 
    note.ClientDate = DateTime.Now; 
    note.RecordedBy = CurrentUser.FullName; 
 
    // add the note type 
    switch (ForeignKeyType) 
    { 
        case ForeignKeyTypes.Branch: 
            BranchNoteEntity bne = new BranchNoteEntity(ForeignKey, note.NoteID); 
            note.BranchNote.Add(bne); 
            break
 
        case ForeignKeyTypes.BranchProspect: 
            BranchProspectNoteEntity bpne = new BranchProspectNoteEntity(ForeignKey.ToInt(), note.NoteID); 
            note.BranchProspectNote.Add(bpne); 
            break
 
        case ForeignKeyTypes.Recruit: 
            RecruitApplicationNoteEntity rne = new RecruitApplicationNoteEntity(ForeignKey.ToInt(), note.NoteID); 
            note.RecruitApplicationNote.Add(rne); 
            break
 
        defaultbreak
    } 
 
    // perform the save 
    note = ServiceProxy.getService<IEntityService>().EntitySave(note) as NoteEntity; 
    msg = note.StatusMessage; 
 
    if (msg.Length > 0) 
    { 
        lblStatusMessage.Text = msg; 
        lblStatusMessage.ForeColor = System.Drawing.Color.Red; 
        ErrorHandler.Handle(new Exception(msg), Request); 
    } 
 
    e.Item.OwnerTableView.IsItemInserted = false
    LoadData(true); 
// RadGrid1_InsertCommand 
 
private void LoadData() 
    LoadData(false); 
private void LoadData(bool rebind) 
    DataSet dsSource = ServiceProxy.getService<INoteService>().FetchNotes(ForeignKeyType, ForeignKey, FetchTypes.Heavy); 
 
    if (dsSource.Tables.Count > 0) 
    { 
        DataColumn dc = new DataColumn("SubjectSummary", Type.GetType("System.String")); 
        dsSource.Tables[0].Columns.Add(dc); 
        foreach (DataRow dr in dsSource.Tables[0].Rows) 
        { 
            string summary = dr["Subject"].ToString().StripTags(); 
            dr["SubjectSummary"] = summary.Length < SummaryLength ? summary : string.Format("{0}...", summary.Left(SummaryLength - 3)); 
        } 
 
        RadGrid1.DataSource = dsSource; 
        if (rebind) 
            RadGrid1.DataBind(); 
    } 
    ErrorHandler.Handle(new ArgumentException(string.Format("No data was returned for the FetchNotes method:\n\nForeignKeyType: {0}\nForeignKey: {1}\n", ForeignKeyType, ForeignKey)), this.Request); 

I've tried all the suggestions from the forums that I could find, including doing the "e.Item.OwnerTableView.IsItemInserted = false;" command, doing a rebind after that, setting the AllowAutomaticInserts to false, etc.

Any ideas?

Thanks
-
Scott
Twinkle
Top achievements
Rank 1
 answered on 27 Oct 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?