Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
236 views

I have a Radgrid where I am doing some extra validation on the InsertMethod. If that validation fails, I need to make sure that the editor stays open so that the user can still perform editing on the form. 

 

My radgrid is declared as follows:

<telerik:RadGrid
                ID="rgRuleExemptions"
                runat="server"
                AutoGenerateColumns="false"
                AllowPaging="true"
                AllowSorting="true"
                ClientSettings-EnableRowHoverStyle="true"
                EnableEmbeddedSkins="False"
                HeaderStyle-Wrap="False"
                RenderMode="Lightweight"
                HeaderStyle-ForeColor="White"
                PageSize="10"
                OnItemDataBound="RadGridRuleExemptions_ItemDataBound">
 
                <PagerStyle Mode="NextPrevAndNumeric" />
 
                <MasterTableView
                    AutoGenerateColumns="false"
                    DataKeyNames="Id"
                    SelectMethod="GetRuleExemptions"
                    InsertMethod="AddRuleExemption"
                    UpdateMethod="UpdateRuleExemption"
                    ItemType="RuleExemptions"
                    CommandItemDisplay="Top">
 
                    <CommandItemSettings />
 
                    <CommandItemTemplate>
                        <div class="text-right" style="background-color: transparent; padding: 5px 5px 5px 5px;">
                            <asp:Button
                                ID="btnAddRuleExemption"
                                runat="server"
                                CssClass="button button-teal button-medium"
                                Text="Add New Record"
                                CausesValidation="False"
                                CommandName="InitInsert" />
                        </div>
                    </CommandItemTemplate>
 
                    <Columns>
                        <telerik:GridButtonColumn
                            UniqueName="EditItem"
                            CommandName="Edit"
                            ItemStyle-Width="40"
                            ItemStyle-HorizontalAlign="Center"
                            ItemStyle-ForeColor="White"
                            Text="Edit"
                            ButtonType="LinkButton"
                            ButtonCssClass="button button-teal button-small">
                            <HeaderStyle Font-Bold="true" />
                        </telerik:GridButtonColumn>
                        <telerik:GridTemplateColumn UniqueName="Id" HeaderText="Id">
                            <ItemTemplate>
                                <asp:Label ID="lblId" runat="server" Text='<%# Item.Id %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="Category" HeaderText="Category">
                            <ItemTemplate>
                                <asp:Label ID="lblCategory" runat="server" Text='<%# Item.Category %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="RuleName" HeaderText="Rule Name">
                            <ItemTemplate>
                                <asp:Label ID="lblRuleName" runat="server" Text='<%# Item.RuleName %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="Version" HeaderText="Version">
                            <ItemTemplate>
                                <asp:Label ID="lblVersion" runat="server" Text='<%# Item.Version %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="NetworkId" HeaderText="Network Id">
                            <ItemTemplate>
                                <asp:Label ID="lblNetworkId" runat="server" Text='<%# Item.NetworkId %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="OperatorId" HeaderText="Operator Id">
                            <ItemTemplate>
                                <asp:Label ID="lblOperatorId" runat="server" Text='<%# Item.OperatorId %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="Justification" HeaderText="Justification">
                            <ItemTemplate>
                                <asp:Label ID="lblJustification" runat="server" Text='<%# Item.Justification %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
 
                    <EditFormSettings EditFormType="Template">
                        <FormStyle />
 
                        <FormTemplate>
                            <div class="form-horizontal" style="margin-top: 15px;">
                                <%--Category--%>
                                <div class="form-group">
                                    <label for="radDropDownCategory" class="col-md-2 control-label">Category <em class="requiredIndicator">*</em></label>
                                    <div class="col-md-5">
                                        <telerik:RadDropDownList runat="server"
                                            ID="radDropDownCategory"
                                            DataTextField="TextDescription"
                                            DataValueField="Value"
                                            RenderMode="Lightweight"
                                            SelectMethod="GetCategories"
                                            SelectedValue='<%# BindItem.Category %>'>
                                        </telerik:RadDropDownList>
                                    </div>
                                </div>
 
                                <%--Rule Name--%>
                                <div class="form-group">
                                    <label for="txtRuleName" class="col-md-2 control-label">Rule Name <em class="requiredIndicator">*</em></label>
                                    <div class="col-md-5">
                                        <asp:TextBox ID="txtRuleName" runat="server" ClientIDMode="Static" Text='<%# BindItem.RuleName %>'
                                            MaxLength="100"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="rfvRuleName" runat="server" ClientIDMode="Static" ControlToValidate="txtRuleName"
                                            ErrorMessage="Rule Name is Required" ValidationGroup="RuleExemptionGroup" CssClass="text-error" Display="Dynamic">
                                        </asp:RequiredFieldValidator>
                                    </div>
                                </div>
 
                                <%--Version--%>
                                <div class="form-group">
                                    <label for="txtVersion" class="col-md-2 control-label">Version <em class="requiredIndicator">*</em></label>
                                    <div class="col-md-3">
                                        <asp:TextBox ID="txtVersion" runat="server" ClientIDMode="Static" Text='<%# BindItem.Version %>'
                                            MaxLength="32"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="rfvVersion" runat="server" ClientIDMode="Static" ControlToValidate="txtVersion"
                                            ErrorMessage="Version is Required" ValidationGroup="RuleExemptionGroup" CssClass="text-error" Display="Dynamic">
                                        </asp:RequiredFieldValidator>
                                    </div>
                                </div>
 
                                <%--Network Id--%>
                                <div class="form-group">
                                    <label for="txtNetworkId" class="col-md-2 control-label">Network Id</label>
                                    <div class="col-md-3">
                                        <asp:TextBox ID="txtNetworkId" runat="server" ClientIDMode="Static" Text='<%# BindItem.NetworkId %>'
                                            MaxLength="32"></asp:TextBox>
                                    </div>
                                </div>
 
                                <%--Operator Id--%>
                                <div class="form-group">
                                    <label for="txtOperatorId" class="col-md-2 control-label">Operator Id</label>
                                    <div class="col-md-3">
                                        <asp:TextBox ID="txtOperatorId" runat="server" ClientIDMode="Static" Text='<%# BindItem.OperatorId %>'
                                            MaxLength="32"></asp:TextBox>
                                    </div>
                                </div>
 
                                <%--Justification--%>
                                <div class="form-group">
                                    <label for="txtJustification" class="col-md-2 control-label">Justification <em class="requiredIndicator">*</em></label>
                                    <div class="col-md-5">
                                        <asp:TextBox ID="txtJustification" runat="server" ClientIDMode="Static" Text='<%# BindItem.Justification %>'
                                            MaxLength="5000" TextMode="MultiLine" Rows="4"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="rfvJustification" runat="server" ClientIDMode="Static" ControlToValidate="txtJustification"
                                            ErrorMessage="Justification is Required" ValidationGroup="RuleExemptionGroup" CssClass="text-error" Display="Dynamic">
                                        </asp:RequiredFieldValidator>
                                    </div>
                                </div>
                            </div>
 
                            <div class="form-horizontal" style="margin-top: 15px;">
                                <%--Form Buttons--%>
                                <div class="form-group">
                                    <label class="col-md-2 control-label"></label>
                                    <div class="col-md-6">
                                        <asp:Button ID="btnSave" runat="server" Text="Save" CssClass="button button-blue btn-md" CommandName="PerformInsert" CausesValidation="true" Visible="false" ValidationGroup="RuleExemptionGroup" />
                                        <asp:Button ID="btnUpdate" runat="server" Text="Update" CssClass="button button-blue btn-md" CommandName="Update" CausesValidation="true" Visible="false" ValidationGroup="RuleExemptionGroup" />
                                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="button button-orange btn-md" CommandName="Cancel" CausesValidation="false" />
                                    </div>
                                </div>
                            </div>
                        </FormTemplate>
                    </EditFormSettings>
                </MasterTableView>
            </telerik:RadGrid>

 

Code behind:

public void AddRuleExemption()
{
            var item = new RuleExemptions();
            var context = new DomainContext();
            var domainObject = new RuleExemptions(context);
 
            TryUpdateModel(item);
            var add = domainObject.AddRuleExemption(item);
 
            if (!add.IsOperationSuccessful)
            {
                pnlErrorMessage.Visible = true;
                lblErrorMessage.Text = add.OperationReturnMessage;
                // I WANT TO KEEP THE EDITOR OPEN HERE...
            }
            else
            {
                lblErrorMessage.Text = "Operation Successful";
            }
        }

 

How can I keep the editor open the add operation was not successful? (Note the line // I WANT TO KEEP THE EDITOR OPEN HERE... above).

Please note that I am using Model Binding in this instance. 

Thanks

 

 

 

Marin Bratanov
Telerik team
 answered on 20 Aug 2018
3 answers
732 views

I am looking at the demo mail app and i noticed that all the menu icons come from the css content: "\e6XX" tag

Rather than looking through every single one is there somewhere that has a reference of them all?

Marin Bratanov
Telerik team
 answered on 20 Aug 2018
1 answer
552 views

     Hi, 

I have successfully got my Radhtmlchart dynamically creating column series based on some data coming from a SQLDataSource (using VB.net). However, the sql data structure (see attachment below) requires the data to be split across an x axis datetime and my series seems to be just adding the series into the first date value regardless of the value in the sql table. I am obviously doing something wrong here (possibly with my table structure or the code).

What I want to achieve is that the two figures for June appear in the June section of the chart (please see attachment below), and the remaining for July and that the chart knows not to repeat series items if they already exist (in the case of "Defect Undefined" and "Failure").

I have also attached my vb code below which shows how the dynamic series is currently being populated. Any help would be appreciated, i've searched high and low and can't seem to find an example close to what I am looking for. Help!

Marin Bratanov
Telerik team
 answered on 20 Aug 2018
6 answers
295 views
Hi, actually I have the code below working fine, but when I put the RadEditor inside an UpdatePanel to make it asynchronous, the code-behind dont get the RadEditor content value. Is it possible to pass the value inside an UpdatePanel, how? thanks


<telerik:RadEditor ID="reComment" runat="server" EditModes="Design" ToolbarMode="ShowOnFocus" ToolsWidth="170px" Width="412px" Height="72px">
 
                    <Tools>
                        <telerik:EditorToolGroup>
                            <telerik:EditorTool Name="Bold" />
                            <telerik:EditorTool Name="Italic" />
                            <telerik:EditorTool Name="StrikeThrough" />
                            <telerik:EditorTool Name="Underline" />
                            <telerik:EditorTool Name="InsertUnorderedList" />
                            <telerik:EditorTool Name="InsertOrderedList" />
                        </telerik:EditorToolGroup>
                    </Tools>
                </telerik:RadEditor>
                <input id="inpHide" name="inpHide" type="hidden" runat="server" />
                <span class="exp-bout-comm">
                    <asp:Button ID="btSubmit" runat="server" Text="Valider" OnClick="btSubmit_Click" /></span>


if (!IsPostBack)
{
    base.OnLoad(e);
    GetExistingComments();
 
    if (ScriptManager.GetCurrent(Page) == null)
    {
        ScriptManager sMgr = new ScriptManager();
        Page.Form.Controls.AddAt(0, sMgr);
    }
 
    btSubmit.Click += new EventHandler(btSubmit_Click);
 
    if (reComment == null)
    {
        reComment = this.FindControl("reComment") as RadEditor;
    }
 
    string content = reComment.Content;
}


Des
Top achievements
Rank 2
 answered on 20 Aug 2018
2 answers
131 views

Hello,

(Looking for a dynamic solution, not a hard-coded one...)

What is the best way for formatted text (content) keywords that are being previewed in the RadEditor able to pop a Tooltip when clicked?

Ideally, a row in a SQL table would describe all the Tooltip keywords and properties... possibly some Find/Replace process could update the content document by encapsulating the keyword with hyperlink tags and update - saved separately in SQL to be future selected (that is, when I'm given a document never seen before, I run a  process that tags any keywords already defined in my SQL table - which prepares the document for deployment ...) Then at runtime of RadEditor preview the tag'd words run the SQL lookup when clicked and pop this dynamic Tooltip... not sure if a custom tag is possible...Tooltip must be dynamic and not hard coded (as this allows the tag'd document to drive the process effortlessly).

I'm sure this is something that has been done before - so only inquiring such that I am not re-inventing the wheel (not asking for anyone to do the work for me, just seeking some advice).

If there is a code example somewhere that I could be directed to and/or some best practices shared, that would be great.

Chuck

 

 

Chuck
Top achievements
Rank 1
 answered on 17 Aug 2018
5 answers
215 views

Hello Team,

 

How do we capture cell double click event in telerik:RadPivotGrid.

My code looks like this:

 <telerik:RadPivotGrid ID="RadPivotGrid1" runat="server"  TotalsSettings-RowsSubTotalsPosition="None" TotalsSettings-ColumnsSubTotalsPosition="None" AllowSorting="true" PageSize="20"
            EnableConfigurationPanel="true" ConfigurationPanelSettings-Position="Left" Width="600px"
            ShowFilterHeaderZone="false" AllowPaging="true" Skin="Metro" OnCellDataBound="RadPivotGrid1_CellDataBound" 
            OnNeedDataSource="RadPivotGrid1_NeedDataSource"
             >
            <Fields>
                 <telerik:PivotGridRowField DataField="Description"></telerik:PivotGridRowField>
                <telerik:PivotGridRowField DataField="Category"></telerik:PivotGridRowField>
                <telerik:PivotGridColumnField DataField="EndDate" ></telerik:PivotGridColumnField>                
                <telerik:PivotGridAggregateField DataField="Amount" DataFormatString="{0:C}"></telerik:PivotGridAggregateField>
             </Fields>
        </telerik:RadPivotGrid>

 

Looking to hear from you.

 

Thanks,

Mohan Pal

 

 

 

Vessy
Telerik team
 answered on 17 Aug 2018
3 answers
325 views

Hello Team,

Like a rad grid has feature of client side data binding. How do we achieve same feature in rad pivot grid.

  var gridView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
  gridView.set_dataSource(result);
  gridView.dataBind();

My expectation is, user clicks a button, call gets redirected to JS file, which in turn save some data to database. now newly saved records to be displayed on pivot grid without making any server side call. 

we can have client side code which calls the API, pulls the data and bind it to pivot grid at client side like rad grid does.

 

Thanks,

Mohan Pal

 

 

Marin Bratanov
Telerik team
 answered on 17 Aug 2018
1 answer
144 views

Hi,

I have the following layout structure.

    <telerik:RadPageLayout ID="rplReportsPage" runat="server" GridType="Fluid">
      <rows>
        <telerik:LayoutRow  HtmlTag="Div" WrapperHtmlTag="Div">
              <Columns>
                <telerik:LayoutColumn Span="12">
                    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
                    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1">
                        <div id="dataDiv" runat="server"></div>
                    </telerik:RadAjaxPanel>
                </telerik:LayoutColumn>
            </Columns>
        </telerik:LayoutRow>
    </rows>
    </telerik:RadPageLayout> 

Following code in the backend (This is only a part of the backend code )

 

  LayoutColumn rLayoutColumn = new LayoutColumn();
  RadListView listView = DefineListViewStructure(parentItemCount, gridHeaderText);
  listView.DataSource = dt;
  listView.DataBind();

   rLayoutColumn.Controls.Add(listView);   
   dataDiv.Controls.Add(rLayoutColumn);

 

Code generates a view like in the attached file. I want to get rid of the highlighted space in the column and place the boxes right below each other. How can I do that?

 

 

 

 

Rumen
Telerik team
 answered on 16 Aug 2018
7 answers
602 views

Hi,

Currently, I have a rad grid which populates search results using client side binding (Select Method). However, I need to update this rad grid now to add new column to it which allows users to select values from a drop down and then save the selected value. I have been trying to use the same client side binding on this grid with the new GridTemplateColumn with a RadComboBox in it, but the issue is that it disappears on pagination and I cannot use NeedDataSource to render the server side RadCombobox as this is a search page and I do not want it to post back for the search results to display each time.

 

Can anyone please help me on how to achieve using a GridTemplateColumn with client side binding?

 

Thanks!

Eyup
Telerik team
 answered on 16 Aug 2018
6 answers
1.4K+ views
Hi! I'm new to ASP and the web in general so bear with me.

I need to add multiple footer rows to my RadGrid instance ; for the moment, however, I just want to add second one. I have currently a single footer row and it's working and displaying perfectly, for the record.

I found the following relevant question on these  forums and tried implemeting it but it's not working : the code gets executed, and the new FooterItem gets added to the Controls but that second row just doesn't appear. I need to find out why and I'd be grateful if anyone could help me fix that problem.

ASP grid code

<div id="OrderMainContent">
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1" />
            <telerik:AjaxSetting AjaxControlID="txtQuantity">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadInputManager ID="RadInputManager1" runat="server">
        <telerik:NumericTextBoxSetting BehaviorID="NumericBehavior1" Type="Number" DecimalDigits="0">
            <TargetControls>
                <telerik:TargetInput ControlID="RadGrid1" />
            </TargetControls>
        </telerik:NumericTextBoxSetting>
    </telerik:RadInputManager>
    <telerik:RadGrid ID="RadGrid1" runat="server" Skin="Sunset" AllowSorting="True" AutoGenerateColumns="False"
        GridLines="None" ShowFooter="True" OnItemDataBound="RadGrid1_ItemDataBound" OnPreRender="RadGrid1_PreRender">
        <MasterTableView DataKeyNames="ProductID" TableLayout="Fixed">
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn UniqueName="colProduct" HeaderText="<%$ Resources: SiteLabels, ProductOrderForm.lblProduct %>"
                    HeaderStyle-HorizontalAlign="Center" DataField="ProdDesc">
                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn UniqueName="colQuantity" HeaderText="<%$ Resources: SiteLabels, ProductOrderForm.lblQuantity %>"
                    HeaderStyle-HorizontalAlign="Center" DataField="OrderQty" ColumnEditorID="txtQuantity">
                    <HeaderStyle Width="90" />
                    <ItemStyle Width="90px" />
                    <ItemTemplate>
                        <asp:TextBox ID="txtQuantity" runat="server" Width="50px" OnTextChanged="txtQuantity_TextChanged"
                            AutoPostBack="true">
                        </asp:TextBox>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="colPrice" HeaderText="<%$ Resources: SiteLabels, ProductOrderForm.lblBasePrice %>"
                    HeaderStyle-HorizontalAlign="Center" DataField="ProdUnitPrice">
                    <HeaderStyle Width="80px" />
                    <ItemStyle Width="80px" />
                    <ItemTemplate>
                        <asp:Label ID="lblPrice" runat="server" Text='<%# Eval("ProdUnitPrice") %>' />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn UniqueName="colNotes" HeaderText="<%$ Resources: SiteLabels, ProductOrderForm.lblNotes %>"
                    HeaderStyle-HorizontalAlign="Center">
                    <HeaderStyle Width="200px" />
                    <ItemStyle Width="200px" />
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings>
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        </ClientSettings>
    </telerik:RadGrid>
</div>


Relevant code behind

protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    AddFooterRow(sender as RadGrid);
}
 
private void AddFooterRow(RadGrid grid)
{
    if (grid != null)
    {
        GridItem[] footerItems = grid.MasterTableView.GetItems(GridItemType.Footer);
 
        if (footerItems.Count() == 1)
        {
            GridTFoot foot = footerItems[0].Parent.Controls[0].Parent as GridTFoot;
 
            for (int i = 0; i < foot.Controls.Count; i++)
            {
                GridFooterItem item = foot.Controls[i] as GridFooterItem;
 
                if(item != null)
                {
                    lastFooterPos = i;
                    break;
                }
            }
 
            GridFooterItem existingFooter = foot.Controls[lastFooterPos] as GridFooterItem;
            GridFooterItem newFooterItem = new GridFooterItem(grid.MasterTableView, 0, 0);
 
            foreach(TableCell fc in existingFooter.Cells)
            {
                TableCell newFooterCell = new TableCell();
                newFooterCell.Text = "allo";
                newFooterItem.Cells.Add(newFooterCell);
            }
 
            foot.Controls.AddAt(lastFooterPos + 1, newFooterItem);
        }
    }
}


Of course if you need more precisions, just ask. Thank you for your help.
Eyup
Telerik team
 answered on 16 Aug 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?