Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
241 views
I have a 5 level hierarchy and need to align all the columns from master to detail, all in a straingt line. I am having only the Headers for the MasterTableView and hiding the Headers for the DetailTables. The Columns are not aligning even after i compensated for the 19 pixel width for the expand-collapse buttons on each Hierarchical level. The problem appears to be due to the Table border width for the nested tables. The Detail table border still appears after i apply the below style.  Somebody Please advise. Thanks in Advance
.rgDetailTable
        {
         border-style: none;
          }
Princy
Top achievements
Rank 2
 answered on 17 Jun 2010
2 answers
302 views
Hi there,

I have a two-level hierarchical grid with a mastertable and some detailtables. Each row in the detail tables has a column with an asp:Image that has an onclick event. The event opens a RadMenu as seen in the attached screenshot.

Here is the menu:
<Telerik:RadContextMenu ID="RadContextMenu1" runat="server" OnClientItemClicked="OnMoveGroupClicked" 
         EnableRoundedCorners="true" EnableShadows="true" AppendDataBoundItems="true" DataSourceID="MilestoneGroupsDS" DataFieldID="pk_miletonegroup_id" DataTextField="milestonegroup_name"
    <Items> 
        <Telerik:RadMenuItem Text="Move to Group:" Enabled="false" /> 
    </Items> 
</Telerik:RadContextMenu> 

Here is the column:
<telerik:GridTemplateColumn UniqueName="move_to_group"
                    <ItemTemplate> 
                        <asp:Image ID="MoveToGroupImg" runat="server" CssClass="cursor_hand" ToolTip="Click to move to another group" ImageUrl="~/Img/folder_arrow.png" onClick="showMenu(event)" /> 
                    </ItemTemplate> 
</telerik:GridTemplateColumn> 

And the javascript:
function showMenu(e) { 
        var contextMenu = $find("<%= RadContextMenu1.ClientID %>"); 
         
        if ((!e.relatedTarget) || (!$telerik.isDescendantOrSelf(contextMenu.get_element(), e.relatedTarget))) 
        { 
            contextMenu.show(e); 
        } 
         
        $telerik.cancelRawEvent(e); 
    } 

Now, when the user clicks an item in the pop up menu I need to know the index of the row where the image was clicked and which detailtable it happened in. Anyone got an idea on how I could achieve that?

I've seen the example in http://www.telerik.com/community/code-library/aspnet-ajax/general/radmenu-as-context-menu-in-hierarchical-radgrid.aspx which uses the OnRowContextMenu event to store the needed data in two hidden fields, but that event isn't useful in my scenario. I've tried to use OnRowMouseOver instead, but the user might hover over other rows before clicking the menu so that wasn't very reliable:

function OnMoveGroupClicked(sender, args) { 
        alert("clicked " + document.getElementById("radGridClickedRowIndex").value + " " + document.getElementById("radGridClickedTableId").value); 
    } 
 
    function OnRowMouseOver(sender, eventArgs) { 
        document.getElementById("radGridClickedRowIndex").value = eventArgs.get_itemIndexHierarchical(); 
        var ownerTable = eventArgs.get_tableView(); 
 
        document.getElementById("radGridClickedTableId").value = ownerTable._data.UniqueID; 
    } 

<input type="hidden" id="radGridClickedRowIndex" name="radGridClickedRowIndex"
<input type="hidden" id="radGridClickedTableId" name="radGridClickedTableId"

<input type="hidden" id="radGridClickedRowIndex" name="radGridClickedRowIndex"
<input type="hidden" id="radGridClickedTableId" name="radGridClickedTableId"


Eirik H
Top achievements
Rank 2
 answered on 17 Jun 2010
6 answers
129 views
Hi,

My RadMaskedTextBox is not allowing you to tab out of the input box when the cursor is in the last place of the mask.  Given the control:

<rad:RadMaskedTextBox ID="MyControl" runat="server" Mask="####" Skin="Default" CssClass="SomeClass" ValidationGroup="SomeGroup"
</rad:RadMasketTextBox> 


you can enter four digits and click tab and focus will leave the input.  You enter the fifth digit and clicking tab does nothing.  You do not need to enter anything at all to recreate the effect.  Simply put focus to the farthest right possible place and tab will be ignored.  anywhere else in the mask and it works normally.  

This occurs in FF (tested in 3.5.5) and does not occur in IE 7.

This only started when I upgraded to 2009.3.1208
Pavel
Telerik team
 answered on 17 Jun 2010
1 answer
97 views
Hi team,

I have one problem to fix this issue with my simple grid (no hierarchie) using one Dataset as source. The Dataset is preserved using session (week_id, price, discount). The grid generate four ajax pages and pager is working as normal (next previous and go to page). I use Edit Inline or other edit modes are causing same problem the item opened to be updated is always at firt page same level. I have tested other scenarios using codes used in demo but is similar. using last Q. Ajax is registred backside joining a masterpage radscriptmanager. Thanks. Romi

<telerik:RadGrid ID="PlanGrid" runat="server" Skin="Vista"  GridLines="None" Width="100%" OnNeedDataSource="PlanGrid_NeedDataSource" 
                                             AutoGenerateColumns="False" AllowMultiRowEdit="True" ShowStatusBar="true" AllowPaging="True" 
                                            OnUpdateCommand="PlanGrid_UpdateCommand" AllowAutomaticUpdates="True" PageSize="14"
                                                 <MasterTableView DataKeyNames="Week" Width="100%" CommandItemDisplay="Top" EditMode="InPlace" > 
                                                               <Columns> 
                                                                <telerik:GridEditCommandColumn  ButtonType="ImageButton" UniqueName="EditCommandColumn"
                                                                    <ItemStyle CssClass="MyImageButton" /> 
                                                                </telerik:GridEditCommandColumn> 
                                                                 <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn"
                                                                        <HeaderTemplate> 
                                                                         <asp:CheckBox id="headerChkbox" OnCheckedChanged="ToggleSelectedState" AutoPostBack="True" runat="server"></asp:CheckBox> 
                                                                        </HeaderTemplate> 
                                                                        <ItemTemplate> 
                                                                            <asp:CheckBox id="CheckBox1" OnCheckedChanged="ToggleRowSelection" AutoPostBack="True" runat="server"></asp:CheckBox> 
                                                                        </ItemTemplate> 
                                                                </telerik:GridTemplateColumn> 
                                                                <telerik:GridBoundColumn UniqueName="Week" SortExpression="Week" HeaderText="Week" ReadOnly="true" 
                                                                    DataField="Week" /> 
                                                                <telerik:GridBoundColumn UniqueName="Days_1d"  HeaderText="Price" 
                                                                    DataField="Days_1d" > 
                                                                    <ItemStyle  Width="100px" /> 
                                                                </telerik:GridBoundColumn>  
                                                                 <telerik:GridBoundColumn UniqueName="Days_promo"  HeaderText="Discount(%)" 
                                                                    DataField="Days_promo" DataType="System.Int32"
                                                                    <ItemStyle  Width="70px" /> 
                                                                </telerik:GridBoundColumn>              
 
                                                            </Columns> 
                                                               <EditFormSettings ColumnNumber="2" CaptionDataField="Week" CaptionFormatString="Edit properties of Week {0}"
                                                                   <FormTableItemStyle Wrap="False"></FormTableItemStyle> 
                                                                    <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle> 
                                                                    <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White" 
                                                                        Width="100%" /> 
                                                                    <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" /> 
                                                                    <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle> 
                                                                    <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update week" 
                                                                        UniqueName="EditCommandColumn1" CancelText="Cancel"
                                                                    </EditColumn> 
                                                                    <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle> 
                                                                </EditFormSettings> 
                                                       
                                                            </MasterTableView> 
                                                <ClientSettings EnableRowHoverStyle="true"
                                                    
                                                </ClientSettings> 
                                                <PagerStyle  Mode="NextPrevAndNumeric" /> 
                                                  
                                            </telerik:RadGrid> 
 
 
//CODE 
 
    protected void PlanGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
        { 
            this.PlanGrid.DataSource = PlanningData; //is a Dataset
        } 
 
     protected void PlanGrid_ItemPreRender(object sender, EventArgs e) 
        { 
            ((sender as GridDataItem)["CheckBoxTemplateColumn"].FindControl("CheckBox1") as CheckBox).Checked = (sender as GridDataItem).Selected; 
 
        } 
        protected void ToggleRowSelection(object sender, EventArgs e) 
        { 
            ((sender as CheckBox).Parent.Parent as GridItem).Selected = (sender as CheckBox).Checked; 
        } 
        protected void ToggleSelectedState(object sender, EventArgs e) 
        { 
            if ((sender as CheckBox).Checked == true) 
            { 
                foreach (GridDataItem dataItem in PlanGrid.MasterTableView.Items) 
                { 
                    (dataItem.FindControl("CheckBox1") as CheckBox).Checked = true
                    dataItem.Selected = true
                } 
            } 
            else 
            { 
                foreach (GridDataItem dataItem in PlanGrid.MasterTableView.Items) 
                { 
                    (dataItem.FindControl("CheckBox1") as CheckBox).Checked = false
                    dataItem.Selected = false
                } 
            } 
        } 
        protected void PlanGrid_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
        { 
            PlanGrid.MasterTableView.EditMode = GridEditMode.EditForms; 
            GridEditableItem eeditedItem = e.Item as GridEditableItem; 
            GridEditManager editMan = editedItem.EditManager; 
 
            foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns) 
            { 
                if (column is IGridEditableColumn) 
                { 
                    IGridEditableColumn editableCol = (column as IGridEditableColumn); 
                    if (editableCol.IsEditable) 
                    { 
                        IGridColumnEditor editor = editMan.GetColumnEditor(editableCol); 
 
                        string editoreditorType = editor.ToString(); 
                        string editorText = "unknown"
                        object editorValue = null
 
                        if (editor is GridTextColumnEditor) 
                        { 
                            editorText = (editor as GridTextColumnEditor).Text; 
                            editorValue = (editor as GridTextColumnEditor).Text; 
                        } 
 
                        if (editor is GridBoolColumnEditor) 
                        { 
                            editorText = (editor as GridBoolColumnEditor).Value.ToString(); 
                            editorValue = (editor as GridBoolColumnEditor).Value; 
                        } 
 
                        if (editor is GridDropDownColumnEditor) 
                        { 
                            editorText = (editor as GridDropDownColumnEditor).SelectedText + "; " + 
                                (editor as GridDropDownColumnEditor).SelectedValue; 
                            editorValue = (editor as GridDropDownColumnEditor).SelectedValue; 
                        } 
 
                        try 
                        { 
                            DataRow[] changedRows = PlanningData.Tables[0].Select("Week= " + editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["Week"]); 
                            changedRows[0][column.UniqueName] = editorValue; 
                            PlanningData.Tables[0].AcceptChanges(); 
                        } 
                        catch (Exception ex) 
                        { 
                            PlanGrid.Controls.Add(new LiteralControl("<strong>Error '" + column.UniqueName + "'</strong> - " + ex.Message)); 
                            e.Canceled = true
                            break; 
                        } 
                    } 
                } 
            } 
            editedItem.Edit = false
        } 

Yavor
Telerik team
 answered on 17 Jun 2010
1 answer
179 views
Hi there,

i have a calendar for which i have added a number of repeatable special days (mon - fri), after adding these i add some other specific special dates.

However, the calendar is not rendered properly.

Firstly, the tooltips of the repeatable days are only shown in the current month view. If you change the month, all tooltips are lost for repeatable days. When returning to the current, only tooltips are shown for the first week, not the other weeks. I find this strange and unlogic behaviour.

Secondly, some days are shown differently in the initial month view after having navigated to another month. Also the days (weekends) that i have changed the background to red, are not shown in the initial month view, but they are shown red after i have changed months.

Thirdly, it seems that on initial month view on one day the standard repeatable day is shown over the specific exception day, and on another day in that month it is just the other way around, the specific exception day is shown over the standard repeatable day.

please see attached files, please advise on how to get my calendar showing proper exception days.

thanks in advance!

How do I make sure that the special days overrule the repeatable days? Or, what logic is used in rendering special days in the calendar?

Here's my code:

 

protected void calAfleverDatum_PreRender(object sender, EventArgs e)  
        {  
            DateTime myDate = DateTime.Today;  
            string sToolTip;              
 
            //-- Set Exception Days --  
            foreach (DeliveryCalendar_Exception myException in lCal_Exception)  
            {  
                RadCalendarDay myDay = new RadCalendarDay();  
 
                myDay.Date = myException.ExceptionDate;  
                myDay.IsSelectable = myException.IsDeliveryDay;  
                myDay.IsDisabled = !myException.IsDeliveryDay;  
 
                if (myException.IsDeliveryDay)  
                    myDay.ItemStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#a2d4a2");  
                else 
                    myDay.ItemStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#e4a2a4");  
 
                sToolTip = myDate.ToString("dddd, MMMM d, yyyy");  
 
                if (myException.Description.Length > 0) sToolTip += "\n\n" + myException.Description;  
 
                if (myException.TimeFrom != null && myException.TimeTo != null)  
                    sToolTip += "\n\nVan:  " + myException.TimeFrom.Value.ToShortTimeString() + "    Tot: " + myException.TimeTo.Value.ToShortTimeString();  
 
                myDay.ToolTip = sToolTip;  
 
                rdpAfleverDatum.Calendar.SpecialDays.Add(myDay);  
            }  
 
            //-- Set Standard Days --  
            while (myDate.DayOfWeek != DayOfWeek.Monday) myDate = myDate.AddDays(1);  
 
            foreach (DeliveryCalendar_Standard myStandard in lCal_Standard)  
            {  
                RadCalendarDay myDay = new RadCalendarDay();  
 
                myDay.Date = myDate;  
                myDay.IsSelectable = myStandard.IsDeliveryDay;  
                myDay.IsDisabled = !myStandard.IsDeliveryDay;  
                myDay.Repeatable = Telerik.Web.UI.Calendar.RecurringEvents.Week;  
 
                if (myStandard.IsDeliveryDay)  
                    myDay.ItemStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#a2d4a2");  
                else 
                    myDay.ItemStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#e4a2a4");  
 
                sToolTip = myDate.ToString("dddd, MMMM d, yyyy");  
 
                if (myStandard.TimeFrom != null && myStandard.TimeTo != null)  
                    sToolTip += "\n\nVan:  " + myStandard.TimeFrom.Value.ToShortTimeString() + "    Tot: " + myStandard.TimeTo.Value.ToShortTimeString();  
 
                myDay.ToolTip = sToolTip;  
 
                rdpAfleverDatum.Calendar.SpecialDays.Add(myDay);  
 
                myDate = myDate.AddDays(1);  
            }  
        } 

Iana Tsolova
Telerik team
 answered on 17 Jun 2010
1 answer
87 views
Hi,

I've been problems in get checkbox from header of radgrid, and I dont know know to obtain this control. I need to access this control because When the user disable a check box from a row, then I need to access the checkbox all to set its checked property by false.

ex: checkboxSelectAll.checked = false;

Could Anybody help me, please?

Thak you for all attention,

Carlos
Shinu
Top achievements
Rank 2
 answered on 17 Jun 2010
2 answers
128 views
Hi,

Is there any way to use the RadTextbox as a Filtered Textbox (like AJAXCONTROLTOOLKIT) where we can define the valid characters of input?

Thanks

Andy Ho
Andy Ho
Top achievements
Rank 1
 answered on 17 Jun 2010
7 answers
446 views
Pretty basic issue - just trying to retrieve the selected value of a RadComboBox on server-side.  Naturally my instinct was to try the SelectedValue but that returns "".  After doing some research through this forum I kind of understand why that is -- it's a client-side thing because of the LoadOnDemand and so the server knows nothing about the selected value.

After some more digging it seemed that the common response to this was to use the "Text" and "Value" properties of the combobox.  The Text property is available and works just fine, however I couldn't find a Value property which was driving me batty.

Eventually I found another thread that indicated the Value should be used on the "Items".  So I tried MyComboBox.Items(0).Value but I got an "Index out of range" error.

Can someone kindly clear up this issue for me?  Thanks!
iTools
Top achievements
Rank 1
 answered on 17 Jun 2010
2 answers
260 views
I am currently enabling and disabling my radtoolbar commanditems (for my radgrid) on the serverside with the following code. This is working fine but requires a postback to the server which is too slow (2 secs before buttons update).

Serverside code (VB):
    Protected Sub radGrid_Cases_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) 
        For Each cmdItem As GridCommandItem In radGrid_Cases.MasterTableView.GetItems(GridItemType.CommandItem) 
            Dim rdtlbr As RadToolBar = DirectCast(cmdItem.FindControl("rtb_Commands"), RadToolBar) 
            rdtlbr.FindItemByText("Edit Case").Enabled = True 
            rdtlbr.FindItemByText("Delete Case").Enabled = True 
            rdtlbr.FindItemByText("Print Case").Enabled = True 
            rdtlbr.FindItemByText("Email Case").Enabled = True 
            rdtlbr.FindItemByText("Edit Payments").Enabled = True 
        Next 
    End Sub 
 
    Public Sub DisableGridCommandButtons() 
        For Each cmdItem As GridCommandItem In radGrid_Cases.MasterTableView.GetItems(GridItemType.CommandItem) 
            Dim rdtlbr As RadToolBar = DirectCast(cmdItem.FindControl("rtb_Commands"), RadToolBar) 
            rdtlbr.FindItemByText("Edit Case").Enabled = False 
            rdtlbr.FindItemByText("Delete Case").Enabled = False 
            rdtlbr.FindItemByText("Print Case").Enabled = False 
            rdtlbr.FindItemByText("Email Case").Enabled = False 
            rdtlbr.FindItemByText("Edit Payments").Enabled = False 
        Next 
    End Sub 
 

I have been trying to change this over to be done on the client side (in the rowselected event) instead to make it more responsive, but I have been unable to find a clientside method of accessing these buttons as they are nested inside the radgrid commanditem toolbar.


GlenB
Top achievements
Rank 1
 answered on 16 Jun 2010
5 answers
1.2K+ views
When do I need to set a value for ClientDataKeyNames? Should this value generally be set to the same values of DataKeyNames?
Cindy Wang
Top achievements
Rank 1
 answered on 16 Jun 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
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?