Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
74 views
Hi..

Got a problem with Radcalendar. Works fine locally on IIS8 click a date and the date stays selected. When I publish to IIS8 I click on a date and the date bounces back to selected date bounces back to today's date. The calendar is on a masterpage is there anything obvious to look for?
Speedcrete
Top achievements
Rank 1
 answered on 04 Jun 2014
3 answers
61 views
Hi All

I am facing issue the order of the attributes get change when load the data in Rad editor, The same order also get change when switch between the design & html mode.
The Tag i insert in the db: &lt; <a style="color: #000000;" class="1" title="C-2, General Commercial" tagname="Primary Zone">C-2, General Commercial</a> &gt;
The tag i got in a html editor: &lt; <a tagname="Primary Zone" title="C-2, General Commercial" class="1" style="color: #000000;">C-2, General Commercial</a> &gt;

Here the order of the attribute is exactly reverse.
The same also get reverse when switch between  the design & Html Mode
Ianko
Telerik team
 answered on 04 Jun 2014
1 answer
114 views
RadNotification doesn't load/show notification messages when there is a RadMediaPlayer on the form with a Playlist populated. Can somebody look into this?

Thanks,

Venu Gadde.
Princy
Top achievements
Rank 2
 answered on 04 Jun 2014
1 answer
130 views
I have a RadGrid From that I have the AutoEdit Turned on - I am am trying to make a couple of the Fields in the "PopUp" Edit Form be multiline as they are of type Ntext and are large. Currently they are just smaller type default Text Cells and cannot see all of the text. Trying to get them to be Multiline and maybe Scrollable.. Below is my code that I have behind in my .aspx.vb code for the page - but it is not making anything happen.

For Edit item.

Protected Sub RadGrid2_ItemDataBound(sender As Object, e As 
GridItemEventArgs)<BR>If TypeOf e.Item Is GridEditFormItem AndAlso 
e.Item.IsInEditMode Then<BR>Dim editItem As GridEditFormItem = TryCast(e.Item, 
GridEditFormItem)<BR>Dim editTable As Table = 
TryCast(TryCast(editItem.EditFormCell, 
GridEditFormItem.EditFormTableCell).Controls(7).Controls(7), 
Table)<BR>editTable.Width = Unit.Percentage(100)<BR>Dim textBox As TextBox = 
DirectCast(editItem("Corrective Action").Controls(7), 
TextBox)<BR>textBox.TextMode = TextBoxMode.MultiLine<BR>TryCast(textBox.Parent, 
TableCell).Width = Unit.Percentage(100)<BR>textBox.Width = 
Unit.Percentage(100)<BR>End If<BR>End Sub

For Create Item

Protected Sub RadGrid2_ItemCreated(sender As Object, e As 
GridItemEventArgs)<BR>If TypeOf e.Item Is GridEditFormItem AndAlso 
e.Item.IsInEditMode Then<BR>Dim editItem As GridEditFormItem = TryCast(e.Item, 
GridEditFormItem)<BR>Dim editTable As Table = 
TryCast(TryCast(editItem.EditFormCell, 
GridEditFormItem.EditFormTableCell).Controls(7).Controls(7), 
Table)<BR>editTable.Width = Unit.Percentage(100)<BR>Dim textBox As TextBox = 
DirectCast(editItem("Corrective Action").Controls(7), 
TextBox)<BR>textBox.TextMode = TextBoxMode.MultiLine<BR>TryCast(textBox.Parent, 
TableCell).Width = Unit.Percentage(100)<BR>textBox.Width = 
Unit.Percentage(100)<BR>End If<BR>End Sub
Shinu
Top achievements
Rank 2
 answered on 04 Jun 2014
1 answer
126 views
In my radgrad I am showing/hiding filter options depending on which filter is clicked on by utilizing the FilterMenuShowing client side function. The problem is it always remembers the last selection. So if in filter A I hide "IsNull", then "IsNull" will also be hidden when I click on Filter B after clicking Filter A. However, if I click Filter B first, "IsNull" is shown. Curiously, if I click Flilter A, then Filter B TWICE, then it works as expected. Why is it remembering the last set of filter options, and how can I fix this?

The following is my code: 

function filterMenuShowing(sender, eventArgs) {
                var menu = eventArgs.get_menu();
                var items = menu._itemData;
                var i = 0;
                while (i < items.length) {
                    var arrMenuOptions = ['GreaterThan', 'LessThan', 'IsEmpty', 'IsNull', 'NotIsEmpty', 'NotIsNull', 'GreaterThanOrEqualTo', 'LessThanOrEqualTo', 'Between', 'NotBetween'];
                    var filterOption = items[i].value;
                    if (arrMenuOptions.contains(filterOption)) {
                        var item = menu._findItemByValue(filterOption);
                        if (item) {
                            var columnName = eventArgs.get_column()._element.UniqueName;
                            
                            if (columnName == "JobNumber" && (filterOption == "GreaterThan" || filterOption == "LessThan")) {
                                item._element.style.display = "";
                            } else if ((columnName == "InitialDate" || columnName == "FinalDate") && (filterOption == "Between" || filterOption == "NotBetween" || filterOption == "IsNull" || filterOption == "NotIsNull" || filterOption == "IsEmpty")) {
                                item._element.style.display = "";
                            } else if ((columnName == "JobDescription" || columnName == "JobCategory" || columnName == "JobType") && (filterOption == "IsEmpty" || filterOption == "NotIsEmpty")) {
                                item._element.style.display = "";
                            } else {
                                item._element.style.display = "none";
                            }
                        }
                    }
                    i++;
                }
            }
Princy
Top achievements
Rank 2
 answered on 04 Jun 2014
7 answers
689 views
Hi,

I'm pretty new to the Telerik controls and also have very little experience with javascript. Here is my problem:

I have a RadGrid that displays some information from a database and allows the user to modify this data by clicking an Edit link button and then using a form template.

I have a client side row double click function that puts the row into edit mode that I found on one of the Telerik support documents, but I need to disable this for specific rows based on the enabled status of the link button.

Code.

I've cut out a lot of the columns of the grid and also the form template as they are not relevant. I've highlighted the relevant parts in bold.

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function RowDblClick(sender, eventargs)
            {
                sender.get_masterTableView().editItem(eventargs.get_itemIndexHierarchical());
            }

        </script>
    </telerik:RadCodeBlock>


<telerik:RadGrid ID="ShiftRadGrid" runat="server" AllowSorting="True" 
                                        AutoGenerateColumns="False" 
                                        DataSourceID="ShiftSqlDataSource" 
                                        ShowFooter="True" GridLines="Both">
                            
                            <ExportSettings ExportOnlyData="True" OpenInNewWindow="True">
                            </ExportSettings>

                            <ClientSettings EnableRowHoverStyle="true">
                                <Selecting AllowRowSelect="True" />
                                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                                <ClientEvents OnRowDblClick="RowDblClick" />
                            </ClientSettings>
                            
                            <MasterTableView DataSourceID="ShiftSqlDataSource" DataKeyNames="id">
                                <Columns>
                                    <telerik:GridEditCommandColumn buttontype="LinkButton"  UniqueName="RadGrdEditCommand" EditText="Edit">
                                    </telerik:GridEditCommandColumn>
                                   
<telerik:GridButtonColumn CommandName="Select" FilterControlAltText="Filter Select column" Text="Select" UniqueName="Select">
                                    </telerik:GridButtonColumn>
                                    <telerik:GridBoundColumn DataField="ScheduleDate" DataFormatString="{0:d}" DataType="System.DateTime" FilterControlAltText="Filter ScheduleDate column" HeaderText="Date Worked" SortExpression="ScheduleDate" UniqueName="ScheduleDate">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="CAName" FilterControlAltText="Filter CAName column" HeaderText="Name" ReadOnly="True" SortExpression="CAName" UniqueName="CAName">
                                        <ItemStyle Wrap="False" />
                                    </telerik:GridBoundColumn>
                                </Columns>
                                <EditFormSettings EditFormType ="Template">
                                    <FormTemplate>
                                        <table id="FormTable" class="Table4" border="0">
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblWorkingDate" runat="server" Text ="Working Date:"></asp:Label>
                                                </td>
                                                <td>
                                                    <telerik:RadDatePicker ID="RadShiftEditWorkingDatePicker" runat="server" 
                                                                            Height="22px" Width="100px"
                                                                            DBSelectedDate='<%# Bind("ScheduleDate", "{0:d}")%>' >
                                                    </telerik:RadDatePicker>
                                                </td>
                                                <td>
                                                    <asp:Label ID="lblHospital" runat="server" Text="Hospital"></asp:Label>
                                                </td>
                                            </tr>

                                        </table>
                                    </FormTemplate>
                                </EditFormSettings>
                            </MasterTableView>
                        </telerik:RadGrid>



Protected Sub ShiftRadGrid_ItemDataBound(sender As Object, e As GridItemEventArgs) Handles ShiftRadGrid.ItemDataBound
        If TypeOf e.Item Is GridDataItem Then
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
            Dim itemCounter As Integer = item.Cells.Count

            Try
                'Dim lnkEdit As LinkButton = DirectCast(e.Item.FindControl("RadGrdEditCommand"), LinkButton)

                Dim lnkEdit As LinkButton = DirectCast(item("RadGrdEditCommand").Controls(0), LinkButton)
                lnkEdit.Enabled = False
               ' I've disabled all rows just to test but this will ultimately be based on logic.


            Catch ex As Exception
' Rest of logic.

End try
end if

    End Sub

Hope this is clear enough. Many thanks.

    







Princy
Top achievements
Rank 2
 answered on 04 Jun 2014
6 answers
196 views
HI,
I have created RadGrid completely programmatically in Page_Init() method with Export to CSV button shown on the Grid. When i click on Export to CSV button is raising exception "Path 'OPTIONS' is forbidden" and some times PROPFIND is forbidden. I have even included in web.config file <add path="*" verb="OPTIONS, PROPFIND" type="System.Web.StaticFileHandler" /> still it gives the same excpetion. Please follow below code.

protected void Page_Init(object sender, EventArgs e)
{
_CurrentUser = (UserDetails)HttpContext.Current.Session["UserDetailSession"];

RadGrid RadGrid1 = new RadGrid();
RadGrid1.ID = "RadGrid1";
RadGrid1.AutoGenerateColumns = false;
RadGrid1.AllowPaging = true;
RadGrid1.AllowSorting = true;
RadGrid1.AllowFilteringByColumn = true;
RadGrid1.PageSize = 50;
RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace;


RadGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
RadGrid1.ItemCommand += new GridCommandEventHandler(RadGrid1_ItemCommand);

GridEditCommandColumn EditColumn = new GridEditCommandColumn();
RadGrid1.MasterTableView.Columns.Add(EditColumn);
EditColumn.UniqueName = "Edit";

List<clsColumnList> listColumnList = null;
DynamicPopulation _objDynamic = new DynamicPopulation();

//please create few columns before usage of listColumnList
foreach (clsColumnList _clsColumnList in listColumnList)
{
GridTemplateColumn _TemplateColumn = new GridTemplateColumn();
_TemplateColumn.ItemTemplate = new ItemTemplate(_clsColumnList.COLUMN_NAME);
_TemplateColumn.EditItemTemplate = new EditItemTemplate(_clsColumnList.COLUMN_NAME, _clsColumnList.DISPLAY_NAME, ViewState["ColumnList"] as List<clsColumnList>, Convert.ToInt32(Session["CurrentMeneID"]));
_TemplateColumn.DataField = _clsColumnList.COLUMN_NAME;
_TemplateColumn.HeaderText = _clsColumnList.DISPLAY_NAME;
_TemplateColumn.UniqueName = _clsColumnList.COLUMN_NAME;

RadGrid1.MasterTableView.Columns.Add(_TemplateColumn);
}

GridButtonColumn DeleteColumn = new GridButtonColumn();
RadGrid1.MasterTableView.Columns.Add(DeleteColumn);
DeleteColumn.ButtonType = GridButtonColumnType.LinkButton;
DeleteColumn.CommandName = "Delete";
DeleteColumn.Text = "Delete";
DeleteColumn.UniqueName = "Edit";
DeleteColumn.HeaderText = "Delete";
DeleteColumn.ConfirmText = "Are you sure, you want to delete?";
RadPane2.Controls.Add(RadGrid1);

}

//Export to CSV button click event captured
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.ExportToCsvCommandName)
{
RadGrid RadGrid1 = sender as RadGrid;
//RadGrid1.ExportSettings.ExportOnlyData = true;
//RadGrid1.ExportSettings.OpenInNewWindow = true;
RadGrid1.ExportSettings.IgnorePaging = true;
RadGrid1.MasterTableView.GetColumn("Edit").Visible = false;
RadGrid1.MasterTableView.GetColumn("Delete").Visible = false;
///RadGrid1.Rebind();
RadGrid1.MasterTableView.ExportToExcel();
}
}

Please someone help me in this regard it would be greatly appreciated.
Kostadin
Telerik team
 answered on 04 Jun 2014
3 answers
1.1K+ views
I would like to find out in the ItemCreated event if one of the rows in the grid is in edit mode.

I am using InPlace editing and I would like to prevent the user from clicking one of the other commands in rows that are not in edit mode.
Also I need to disable some other fields in my form if the user is editing an item.
Princy
Top achievements
Rank 2
 answered on 04 Jun 2014
4 answers
253 views
I have a checkbox in commanitem template.
I display the checkbox based on some values in the database and change the text of the checkbox accordingly.

On the first page load, my checkbox does not retain the values i set in the prerender event. After i do some postback (via the button in the itemtemplate) it displays the checkbox correctly. I set the grid in edit mode in my pre render event.

below is my code:
        protected void rgFunds_PreRender(object source, EventArgs e)
        {
            Button btnPostTransaction = (Button)rgFunds.MasterTableView.GetItems(GridItemType.CommandItem)[0].FindControl("btnPostTransaction");
            CheckBox chkAutoRebalance = (CheckBox)rgFunds.MasterTableView.GetItems(GridItemType.CommandItem)[0].FindControl("chkAutoRebalance");
 
            //Puts the grid in editmode
            if (!IsPostBack)
            {
                foreach (GridItem item in rgFunds.MasterTableView.Items)
                {
                    if (item is GridEditableItem)
                    {
                        GridEditableItem editableItem = item as GridDataItem;
                        editableItem.Edit = true;
                    }
                }
                rgFunds.Rebind();
            }
 
            //Set the AutoRebalance flag
            foreach (GridDataItem item in rgFunds.Items)
            {
                HtmlInputHidden _fundID = (HtmlInputHidden)item.FindControl("_fundID");
                int OnOff = Int32.Parse(_fundID.Value);
                chkAutoRebalance.Checked = OnOff == 1 ? true : false;
            }
 
            // Get the AutoRebalancing flag from plan settings
            if (ShowPostTransactionButton && IsCurrentEmployee && _allocationType == FundAllocation.AllocationType.Rebalance)
            {
                DataTable dtAutoRebalanceFrequency = FundRebalance.GetAutoRebalanceFrequencyByPlan(base.PlanID, DateTime.Now);
 
                if (dtAutoRebalanceFrequency.Rows.Count > 0)
                {
                    AutoRebalanceFrequency = dtAutoRebalanceFrequency.Rows[0][FundRebalance.Fields.RebalanceFrequency].ToString();
 
                    if (dtAutoRebalanceFrequency.Rows[0][FundRebalance.Fields.RebalanceFrequencyID].ToString() == ((int)FundRebalance.AutoRebalanceFrequency.NotAllowed).ToString())
                    {
                        chkAutoRebalance.Visible = false;
                        chkAutoRebalance.Checked = false;
                    }
                    else
                    {
                        chkAutoRebalance.Visible = true;
                        chkAutoRebalance.Text = "Auto Rebalance (" + AutoRebalanceFrequency + ")";
                    }
                }
                else
                {
                    chkAutoRebalance.Visible = false;
                    chkAutoRebalance.Checked = false;
                }
            }           
        }
 
Grid declaration:
 
<telerik:RadGrid ID="rgFunds" runat="server" AllowSorting="False" EnableViewState="false"
                        GridLines="Both" AllowMultiRowEdit="true" OnPreRender="rgFunds_PreRender" OnItemDataBound="rgFunds_ItemDataBound"
                        OnItemCommand="rgFunds_ItemCommand" OnNeedDataSource="rgFunds_NeedDataSource">
                        <MasterTableView TableLayout="Fixed" HierarchyDefaultExpanded="true" CommandItemDisplay="Bottom"
                            EditMode="InPlace" EnableNoRecordsTemplate="true">
                            <CommandItemTemplate>
                                <table width="100%">
                                    <tr>
                                        <td colspan="4" align="left">
                                            <asp:CheckBox ID="chkAutoRebalance" runat="server" Visible="true" ForeColor="White"
                                                OnCheckedChanged="chkAutoRebalance_CheckedChanged" />
                                        </td>
                                        <td align="right">
                                            <asp:Button ID="btnPostTransaction" runat="server" Text="Post Transaction" CssClass="button"
                                                CommandName="PostTransaction" />
                                        </td>
                                    </tr>
                                </table>
                            </CommandItemTemplate>
                            <Columns>
                                <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"
                                    FooterStyle-HorizontalAlign="Left" UniqueName="InvestmentOptions" ReadOnly="true"
                                    HeaderText="Investment Options">
                                    <ItemTemplate>
                                        <asp:Label ID="_fundName" runat="server" Text='<%# Eval("fundName")%>'></asp:Label>
                                        <asp:CheckBox ID="_excludeFund" runat="server" Checked='<%# Eval("allowRebalanceExclude")%>'
                                            Text="Exclude?" Visible='<%# Eval("allowRebalanceExclude")%>' />
                                        <input type="hidden" id="_fundID" runat="server" />
                                        <input type="hidden" id="_autoRebalanceFlag" runat="server" />
                                        <input type="hidden" id="_allowRebalance" runat="server" />
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        <strong>Total must equal 100%</strong></FooterTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Right" HeaderText="Current %"
                                    HeaderStyle-Width="25%" ReadOnly="true" DataField="currentPercent" UniqueName="currentPercent">
                                    <ItemTemplate>
                                        <asp:Label ID="_currentPercent" runat="server" Text='<%# Eval("currentPercent", "{0:N2}%")%>'>
                                        </asp:Label></ItemTemplate>                                 
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Right" UniqueName="futurePercent"
                                    HeaderStyle-Width="25%" HeaderText="New %">
                                    <ItemTemplate>
                                        <asp:Label ID="_futurePercent" runat="server" Text='<%# Eval("futurePercent", "{0:N2}%")%>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtNewPercent" runat="server" CssClass="percent" groupName="allocations"
                                            Width="40px" onchange="SumGroup(this, false)" Text='<%# Eval("futurePercent")%>' />
                                        %
                                        <asp:RangeValidator ID="newPercentageRange" runat="server" ControlToValidate="txtNewPercent"
                                            Type="Integer" CssClass="errormessagesmall" Display="None" />
                                        <asp:CustomValidator ID="newPercentageIncrement" runat="server" ControlToValidate="txtNewPercent"
                                            ClientValidationFunction="Mod_ClientValidate" CssClass="errormessagesmall" Display="None" />
                                        <cc1:ValidatorCalloutExtender ID="newPercentageRangeCallout" runat="server" TargetControlID="newPercentageRange"
                                            Width="235px" />
                                        <cc1:ValidatorCalloutExtender ID="newPercentageIncrementCallout" runat="server" TargetControlID="newPercentageIncrement"
                                            Width="235px" />
                                    </EditItemTemplate>
                                    <FooterTemplate>
                                        <asp:TextBox ID="fundTotal" runat="server" CssClass="percent" onfocus="blur()" Enabled="false"
                                            Font-Bold="true" ForeColor="Black" Width="40px" />
                                        %
                                        <asp:CompareValidator ID="totalEqual100" runat="server" ControlToValidate="fundTotal"
                                            ValueToCompare="100" Operator="Equal" CssClass="errormessagesmall" Display="None"
                                            ErrorMessage="New allocations must total 100%." />
                                        <asp:RequiredFieldValidator ID="fundTotalRequired" runat="server" ControlToValidate="fundTotal"
                                            Display="None" Visible="false" ErrorMessage="You <em>must</em> enter an allocation." />
                                        <cc1:ValidatorCalloutExtender ID="fundTotalRequiredCallout" runat="server" TargetControlID="fundTotalRequired"
                                            Width="235px" />
                                        <cc1:ValidatorCalloutExtender ID="totalEqual100Callout" runat="server" TargetControlID="totalEqual100"
                                            Width="235px" />
                                    </FooterTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
Shinu
Top achievements
Rank 2
 answered on 04 Jun 2014
5 answers
282 views
I have attached a screen shot of my "Edit" Form that opens when I click on Edit from the RadGrid. I am trying to find out how you change the display/edit size of certian fields within the "Edit" Form.

For example the field "CorrectiveAction:" is a large "NText" field and I would like to increase the display/edit field in the Edit Form to show more of the field and even make it a scrollable field so you could see all the text in the field.

Another example is in the field "Status:" I would like to make it a dropdown list and not a free form list to all a user to pick an item and not free form the text.

Any help would be appriciated.

Thx,
Alex.

Princy
Top achievements
Rank 2
 answered on 04 Jun 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?