Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
894 views

After I edit/insert a record in my grid, I want the edit template to go away.  I want this to happen for two reasons.  1) Once the user edits/inserts the record, there's no need for that edit/insert row to remain.  2) The template has a required field validator on it and when the user posts back in another part of the page the required field validator gets triggers on the field in this template.

 

I've tried MyGroupsRadGrid.MasterTableView.ClearEditItems() after the insert logic on MyGroupsRadGrid_InsertCommand() but that doesn't work.  I've tried e.Canceled = true but that doesn't work.  I've tried e.Item.Edit = false but that errors.

<telerik:RadGrid ID="MyGroupsRadGrid" runat="server" OnNeedDataSource="MyGroupsRadGrid_NeedDataSource"
    AutoGenerateColumns="false" AutoPostBackOnFilter="true" OnUpdateCommand="MyGroupsRadGrid_UpdateCommand" OnItemDataBound="MyGroupsRadGrid_ItemDataBound"
    AllowSorting="true" AllowAutomaticUpdates="True" AllowAutomaticInserts="True" OnEditCommand="MyGroupsRadGrid_EditCommand" OnSelectedIndexChanged="MyGroupsRadGrid_SelectedIndexChanged1"
    AllowFilteringByColumn="false" OnCancelCommand="MyGroupsRadGrid_CancelCommand" MasterTableView-CommandItemDisplay="Top" OnInsertCommand="MyGroupsRadGrid_InsertCommand">
    <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true" EnableRowHoverStyle="true">
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
    <MasterTableView DataKeyNames="BWGroupID">
        <EditFormSettings EditFormType="Template">
            <FormTemplate>
                <table id="Table1" class="marginleft50 bordercollapse width100percent" cellspacing="2" cellpadding="1" border="0" rules="none">
                    <tr>
                        <td valign="top">
                            <table id="Table2" class="bordercollapse" cellspacing="2" cellpadding="1" border="0" rules="none">
                                <tr id="BWGroupIDRow" runat="server">
                                    <td>Group ID   </td>
                                    <td><asp:Label ID="BWGroupIDLabel" runat="server" Text='<%# Bind("BWGroupID") %>' /></td>
                                </tr>
                                <tr id="BWGroupNameRow" runat="server">
                                    <td>Group Name   </td>
                                    <td>
                                        <asp:TextBox ID="GroupNameTextBox" runat="server" Text='' />
                                        <asp:RequiredFieldValidator ID="RequiredGroupName" runat="server" ControlToValidate="GroupNameTextBox" ForeColor="Red" Text="*A Group Name is Required." />
                                    </td>
                                </tr>
                                <tr id="DisplayNameRow" runat="server">
                                    <td>Group Owner   </td>
                                    <td>
                                        <telerik:RadComboBox ID="OwnerRadComboBox" runat="server" OnClientSelectedIndexChanged="enableAddSelectionButton" Width="270px" DataTextField="Value" DataValueField="Key" ValidationExpression="[\w\s\.,_-]+$" AppendDataBoundItems="True" Filter="Contains">
                                            <Items>
                                                <telerik:RadComboBoxItem runat="server" Text="" Value="-1" />
                                            </Items>
                                        </telerik:RadComboBox>
                                        <br />
                                        <asp:Label ID="OwnerError" runat="server" ForeColor="Red" Visible="true" />
                                    </td>
                                </tr>
                                <tr id="IsActiveRow" runat="server">
                                    <td>Status   </td>
                                    <td><asp:Label ID="Label8" runat="server" Text='<%# Eval("IsActive").ToString() == "True" ? "Active" : "Inactive" %>' /></td>
                                    <td><asp:CheckBox ID="DeactivateCheckBox" runat="server" Text="Deactivate Group" /></td>
                                </tr>
                                <tr>
                                    <td align="center" colspan="2">
                                        <br />
                                        <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                            runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' /> 
                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td valign="top"></td>
                    </tr>
                </table>
                <br />
            </FormTemplate>
        </EditFormSettings>
        <Columns>
            <telerik:GridEditCommandColumn ButtonType="LinkButton" EditText="Edit" UniqueName="EditCommandColumn"></telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn UniqueName="BWGroupID" DataField="BWGroupID" HeaderText="Group ID" SortExpression="BWGroupID" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" />
            <telerik:GridBoundColumn DataField="BWGroupName" HeaderText="Group Name" ReadOnly="true" SortExpression="BWGroupName" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" />
            <telerik:GridBoundColumn DataField="ComputedBWGroupUserCount" HeaderText="Member Count" SortExpression="ComputedBWGroupUserCount" FilterControlWidth="50px" AutoPostBackOnFilter="true" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Code behind:

protected void MyGroupsRadGrid_InsertCommand(object sender, GridCommandEventArgs e)
{
    int parseOwnerId = -1;
 
    try
    {
        GridEditableItem editedItem = (GridEditableItem)e.Item;
        if (e.CommandName == "PerformInsert")
        {
            #region Get controls
            TextBox GroupNameTextBox = new TextBox();
            GroupNameTextBox = (TextBox)e.Item.FindControl("GroupNameTextBox");
 
            RadComboBox OwnerRadComboBox = (RadComboBox)editedItem.FindControl("OwnerRadComboBox");
            int.TryParse(OwnerRadComboBox.SelectedValue, out parseOwnerId);
            #endregion
 
            BWGroup newGroup = new BWGroup();
            newGroup.BWUserIDCreated = BWSessionHandler.BWID;
 
            BWUser selectedOwner = new BWUser();
 
            if (parseOwnerId > 0)
            {
                selectedOwner = this._bwContext.BWUsers.Where(x => x.BWUserID == parseOwnerId).FirstOrDefault();
                if (selectedOwner.BWUserID != null && selectedOwner.BWUserID > 0)
                    newGroup.BWUserIDOwner = selectedOwner.BWUserID;
            }
            newGroup.BWUserIDUpdated = BWSessionHandler.BWID;
            newGroup.BWGroupName = GroupNameTextBox.Text;
            newGroup.IsActive = true;
            newGroup.SystemGenerated = false;
            newGroup.RowInsertDateTime = DateTime.Now;
 
            this._bwContext.BWGroups.InsertOnSubmit(newGroup);
            this._bwContext.SubmitChanges();
 
            ViewState["SelectedGroupId"] = newGroup.BWGroupID;
            MyGroupsRadGrid.MasterTableView.Items[0].Edit = false;
            MyGroupsRadGrid.MasterTableView.ClearEditItems();
            MyGroupsRadGrid.Rebind();
 
            GroupMemberRadGrid.MasterTableView.IsItemInserted = false;
            GroupMemberRadGrid.Rebind();
            AssignNameOfGroup(newGroup.BWGroupName);
            GroupMemberRadGrid.Enabled = true;
 
            foreach (GridDataItem row in MyGroupsRadGrid.MasterTableView.Items)
            {
                if (row.GetDataKeyValue("BWGroupID").ToString() == ViewState["SelectedGroupId"].ToString())
                {
                    row.Selected = true;
                    break;
                }
            }
            e.Canceled = true;
        }
    }
    catch (Exception ex) { this.ThrowError(ex, parseOwnerId); }
}
Jeremy
Top achievements
Rank 1
 answered on 27 Jun 2018
1 answer
109 views
When I publish a page with a RadMap control on it and run it with SSL, the page apparently has mixed content and does not show the green badge. I assume then calls to the mapservice are still http, is there a way to fix this?
Marin Bratanov
Telerik team
 answered on 27 Jun 2018
1 answer
100 views

Hi,

        I want to use rad window to both primary and secondary monitor. But i am not able to drag my rad window to secondary monitor which is displayed in primary monitor .

sample code:

div>
    <telerik:RadWindow RenderMode="Lightweight" runat="server" ID="rad_simpleNote" Modal="false" Width="340px" Height="340px" VisibleTitlebar="true">
        <ContentTemplate>
            <table>
                <td>
                    <asp:Label ID="username" runat="server" Text="This is building 1 note" CssClass="ContentLabel" />
                </td>
            </table>
        </ContentTemplate>
    </telerik:RadWindow>
</div>

Thanks,

Harikka.

Marin Bratanov
Telerik team
 answered on 27 Jun 2018
1 answer
90 views

It was working for me at one point and then it stopped.  no matter what I have tried the event just did not fire and I couldn't figure out why  I have posted my both code behind and aspx.  Any help would be much appreciated.

Code behind:

protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["CompanyID"] != null)
            CompanyId = (Guid)Session["CompanyID"];
        if (Session["UserID"] != null)
            UserId = (Guid)Session["UserID"];
        if (!Page.IsPostBack)
        {
            loadBatchFileLog();
            rgBatchLog.DataSource = loadBatchFileLog();
            rgBatchLog.DataBind();
        }
    }

 private ICollection loadBatchFileLog()
    {
        DataView dv = new DataView();
        List<BatchOrderingTransform> info = new List<BatchOrderingTransform>();
        info = bll.GetBatchFileLog(CompanyId);
        if (info.Count > 0)
        {
            DataTable dt = new DataTable();
            dt = Common.ToDataTable<BatchOrderingTransform>(info);
            dv = new DataView(dt);
        }
        return dv;
}

protected void rgBatchLog_UpdateCommand(object sender, GridCommandEventArgs e)
    {
        long id = Convert.ToInt64(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"].ToString());
        var name = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Username"].ToString();
        var fileName = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["FileName"].ToString();
        bll.DeactivateBatchFile(id, name);
        loadBatchFileLog();
    }

aspx:

<telerik:RadGrid ID="rgBatchLog" runat="server" AutoGenerateColumns="false" GridLines="None" OnItemDataBound="rgBatchLog_ItemDataBound"
        allowPaging="true" AllowSorting="true" Width="100%" OnUpdateCommand="rgBatchLog_UpdateCommand">
        <PagerStyle Mode="Slider" />
        <MasterTableView AllowAutomaticDeletes="True" DataKeyNames="ID, CompanyId, Username, FileName,IsProcessed">
            <RowIndicatorColumn>
                    <HeaderStyle Width="20px" />
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px" />
                </ExpandCollapseColumn>
            <Columns>
                <telerik:GridHyperLinkColumn DataTextField="Details" ItemStyle-ForeColor="Blue" SortedBackColor="Blue" UniqueName="ID" DataNavigateUrlFields="ID" DataNavigateUrlFormatString="BatchReportDetails.aspx?BatchID={0}"
                    HeaderText="" Text="Details" SortExpression="ID"> <ItemStyle CssClass="hyperlink" /> </telerik:GridHyperLinkColumn>             
                <telerik:GridBoundColumn DataField="ServiceName" HeaderText="Package" UniqueName="ServiceName" />
                <telerik:GridBoundColumn DataField="OriginalFileName" HeaderText="File Name" UniqueName="OriginalFileName" />
                <telerik:GridBoundColumn DataField="ProcessRequestedDate" HeaderText="Scheduled Run Date" UniqueName="ProcessRequestedDate" />
                <telerik:GridBoundColumn DataField="IsProcessed" HeaderText="Is File Processed" UniqueName="IsProcessed" />
                <telerik:GridBoundColumn DataField="Name" HeaderText="User Name" UniqueName="Name"/>
                <telerik:GridBoundColumn DataField="UserEmail" HeaderText="User Email" UniqueName="UserEmail"/>
                <telerik:GridBoundColumn DataField="InputEmail" HeaderText="Input Email" UniqueName="InputEmail"/>
                <telerik:GridBoundColumn DataField="Created" HeaderText="Created" UniqueName="Created"/>
                <telerik:GridButtonColumn CommandName="Deactivate" ItemStyle-ForeColor="Blue" ButtonType="LinkButton" Text="Deactivate" UniqueName="Deactivate" CommandArgument="" ConfirmDialogType="Classic" ConfirmText="Are you sure you want to deactivate this record?"></telerik:GridButtonColumn>
            </Columns>
        </MasterTableView>
        <FilterMenu Skin="Vista" EnableTheming="True">
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
        </FilterMenu>
    </telerik:RadGrid>

Eyup
Telerik team
 answered on 27 Jun 2018
32 answers
520 views
Hi,

I have a Button and Radeditor in Page1 and upon Button click it should navigate me to another page. If the RadEditor contains any spell errors in its content it should not navigate me to Page 2 and it should alert me "Please start spell check". If there are no spell errors without any spell check it should be navigated to Page2.

Please let me know any solution for this.

Thanks
Samba
Anshuman
Top achievements
Rank 1
 answered on 26 Jun 2018
3 answers
241 views

I am trying to apply a style to a nested tab strip.  Specifically I am trying to set the border-top-color for the selected child tab.  I can do this for the parent tab and I am able to modify other attributes of the child tab, just not that specific one. 

Any insight would be appreciated. 

<style>
        .RadTabStrip_Vista .rtsLevel1 .rtsSelected .rtsLink {           
            font-family: Arial ;
            border-top-color:#fdb845 ;
            border-top-width:2px;
        }
    
        .childTabSelected {
            font-family: Arial  ;
            border-top-color:#00a2ff !important ;
            border-top-width:2px;
        }
 
    </style>
    <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" />
    <div>
        <telerik:RadTabStrip RenderMode="Lightweight" ID="RadTabStrip1" runat="server">
            <Tabs>
                <telerik:RadTab runat="server" Text="Tab1">
                    <Tabs>
                        <telerik:RadTab runat="server" Text="Child Tab 1"
                            SelectedCssClass="childTabSelected" />
                        <telerik:RadTab runat="server" Text="Child Tab 2"
                            SelectedCssClass="childTabSelected" />
                        <telerik:RadTab runat="server" Text="Child Tab 3"
                            SelectedCssClass="childTabSelected" />
                        <telerik:RadTab runat="server" Text="Child Tab 4"
                            SelectedCssClass="childTabSelected" />
                        <telerik:RadTab runat="server" Text="Child Tab 5"
                            SelectedCssClass="childTabSelected" />
                    </Tabs>
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="Tab2" Selected="True">
                    <Tabs>
                        <telerik:RadTab runat="server" Text="Child Tab 2.1"
                            SelectedCssClass="childTabSelected" />
                        <telerik:RadTab runat="server" Text="Child Tab 2.2" Selected="True"
                            SelectedCssClass="childTabSelected" />
                        <telerik:RadTab runat="server" Text="Child Tab 2.3"
                            SelectedCssClass="childTabSelected" />
                        <telerik:RadTab runat="server" Text="Child Tab 2.4"
                            SelectedCssClass="childTabSelected" />
                        <telerik:RadTab runat="server" Text="Child Tab 2.5"
                            SelectedCssClass="childTabSelected" />
                    </Tabs>
                </telerik:RadTab>
 
                <telerik:RadTab runat="server" Text="Tab3" />
            </Tabs>
        </telerik:RadTabStrip>
Rumen
Telerik team
 answered on 26 Jun 2018
1 answer
109 views

We are using the RadListView binding to data from a Web API call...  When data is updated - we use the client-size code:

listView.set_dataSource(data);
listView.dataBind();

Is there a way we can apply an animation when data is updated?  Currently it just draws in the new/updated data in a jarring / clunky fashion.

Marin Bratanov
Telerik team
 answered on 25 Jun 2018
1 answer
527 views
I have a radspreadsheet control that I bound from the server to an existing spreadsheet.  What I would like to know is can I update the cells on the spreadsheet with values from the code behind.  And if so, how do I go about doing it.  All of the examples are added a new worksheet and not updating an existing one
Marin Bratanov
Telerik team
 answered on 25 Jun 2018
2 answers
195 views

Hello,

There seems to be an issue with the "Strip Span Elements" tool when pasting content into the editor in Design mode.

I have made a screencast demonstrating the issue available here: https://www.screencast.com/t/1OZ1huYPde8H

Reproduce:

  • Open a RadEditor demo that has the "Strip Span Elements" option like the Overview or the Right Editor in this demo.
  • In a word document create text that when pasted into the editor has spans, for example changing the background color or the text color. 
  • Copy the text from the document into the "Design" mode of the editor.
  • Select the text you would like to strip span's from (I used all of the text in the screencast example).
  • Use the "Strip Span Elements" button.
  • Switch the editor mode to HTML(The spans are not stripped).
  • Switch back to design mode.
  • Select the text you would like to remove spans from again.
  • Use the "Strip Span Elements" button. The spans are now stripped.

 

Expected result: Strip Span Elements option removes <span> tags from html directly after pasting into design mode.

Actual result: Strip Span Elements option does not remove <span> tags on pasted text in the design mode until you navigate to HTML mode then back to design mode.

 

Any help and suggestions are appreciated.

 

Thanks,

 

Calvin Williams

Marin Bratanov
Telerik team
 answered on 25 Jun 2018
2 answers
317 views

I am hoping this is a simple question

I have a Menu using the Bootstrap theme, and am wanting to remove the rmRightArrow sprite from showing.

The arrow that comes standard in it is too small for us, and are wanting to use the bigger arrow seen in the image.

I have inspected and found the following to be where the arrow is, but cannot remove it as a default.

 

.RadMenu_Bootstrap .rmHorizontal>.rmItem .rmExpandDown:after, .RadMenu_Bootstrap .rmHorizontal>.rmItem .rmExpandTop:after, .RadMenu_Bootstrap .rmHorizontal>.rmItem .rmExpandLeft:after, .RadMenu_Bootstrap .rmHorizontal>.rmItem .rmExpandRight:after {
content: "";
margin: 0 -4px 0 4px;
border: 4px solid transparent;
border-top-color: inherit;
display: inline-block;

If I untick the 'content' item, the little arrow disappears.

How do I remove it as I don't want to have two arrows displayed.

Thank you in advance.

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