Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
222 views
When looking at the Telerik website forums called UI for ASP.NEXT Ajax I have the following questions:
1. it looks like you have an option to have html generated by an asp.net form can either edit your applications' html or not.To be able to have your html edited or not would you show me/tell me how to to set this up? **I would assume this is a web.config file setting
2. Does the radedior generate its own html? IF so, does the radeditor generate the html to fix html errors? If so how can you have the radeditor not generate its own html?
Rumen
Telerik team
 answered on 19 Dec 2018
4 answers
365 views

Requirements

RadControls version 2011.1.519.40
.NET version 4.0
Visual Studio version 2010
programming language C#
browser support

all browsers supported by RadControls


PROJECT DESCRIPTION
Here I have one radgrid in which I have two boundcolumns and others are I have added dynamically at runtime "GridTemplateColumn" from code behind. In which I have added one check box control in ItemTemplate. Here also I have one save button outside of the radgrid. Now when I am clicking on that save button I can getting that checkbox added dynamically in columns on click of save button.


Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadButton1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="lblColumn1" />
                        <telerik:AjaxUpdatedControl ControlID="lblColumn2" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>
    </div>
    <div>
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource"
            OnItemDataBound="RadGrid1_ItemDataBound" OnPreRender="RadGrid1_PreRender">
            <MasterTableView DataKeyNames="ID">
                <Columns>
                    <telerik:GridBoundColumn DataField="ID" HeaderText="ID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Name" HeaderText="Name">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
        <br />
        <telerik:RadButton ID="RadButton1" Text="Click for selected item" runat="server"
            OnClick="RadButton1_Click">
        </telerik:RadButton>
        <br />
        <asp:Label ID="lblColumn1" runat="server"></asp:Label>
         
    </div>
    </form>
</body>
</html>


Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data;
using System.Text;
 
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Init(object sender, EventArgs e)
    {
        // you can dynamically add multiple column by for each loop
 
        foreach (DataRow dr in Class1.GetDataTable().Rows)
        {
            GridTemplateColumn objGridTemplateColumn = new GridTemplateColumn();
            objGridTemplateColumn.HeaderText = dr["ColumnUniqueName"].ToString();
            objGridTemplateColumn.UniqueName = dr["ColumnUniqueName"].ToString();
            objGridTemplateColumn.ItemTemplate = new MyTemplate(dr["ColumnControlID"].ToString());
            RadGrid1.MasterTableView.Columns.Add(objGridTemplateColumn);
        }
 
    }
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        dynamic data = new[] {
                new { ID = 1, Name ="Name1",Isbool = true},
                new { ID = 2, Name = "Name2",Isbool = false},
                new { ID = 3, Name = "Name3",Isbool = true},
                new { ID = 4, Name = "Name4",Isbool = false},
                new { ID = 5, Name = "Name5",Isbool = true},
                new { ID = 6, Name ="Name6",Isbool = true},
                new { ID = 7, Name = "Name7",Isbool = false},
                new { ID = 8, Name = "Name8",Isbool = true},
                new { ID = 9, Name = "Name9",Isbool = true},
                new { ID = 10, Name = "Name10",Isbool = false}
            };
 
        RadGrid1.DataSource = data;
    }
    protected void RadButton1_Click(object sender, EventArgs e)
    {
        StringBuilder sb = new StringBuilder();
 
        foreach (GridDataItem item in RadGrid1.Items)
        {
            foreach (DataRow dr in Class1.GetDataTable().Rows)
            {
                CheckBox objCheckBox = (CheckBox)item[dr["ColumnUniqueName"].ToString()].Controls[0];
                if (objCheckBox.Checked)
                {
                    sb.Append(dr["ColumnUniqueName"].ToString() + " : " + item.GetDataKeyValue("ID").ToString());
                    sb.Append("</br>");
                }
            }
        }
 
        lblColumn1.Text = sb.ToString();
    }
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = e.Item as GridDataItem;
 
            foreach (DataRow dr in Class1.GetDataTable().Rows)
            {
                if(dr["ColumnUniqueName"].ToString() == "CheckBoxColumn1")
                {
                    if (Convert.ToInt32(item.GetDataKeyValue("ID")) == 1 || Convert.ToInt32(item.GetDataKeyValue("ID")) == 3)
                    {
                        CheckBox chkTemp = (CheckBox)item[dr["ColumnUniqueName"].ToString()].Controls[0];
                        chkTemp.Checked = true;
                    }
                }
                else if (dr["ColumnUniqueName"].ToString() == "CheckBoxColumn2")
                {
                    if (Convert.ToInt32(item.GetDataKeyValue("ID")) == 2 || Convert.ToInt32(item.GetDataKeyValue("ID")) == 4)
                    {
                        CheckBox chkTemp = (CheckBox)item[dr["ColumnUniqueName"].ToString()].Controls[0];
                        chkTemp.Checked = true;
                    }
                }
            }
        }
    }
    protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        int count = 0;
        foreach (GridColumn column in RadGrid1.Columns)
        {
            count++;
            if (count > Class1.GetDataTable().Columns.Count + 2)
            {
                column.Visible = false;
            }
        }
    }
}
 
public class MyTemplate : ITemplate
{
 
    protected CheckBox boolValue;
    private string colname;
 
    public MyTemplate(string cName)
    {
        colname = cName;
    }
 
    public void InstantiateIn(System.Web.UI.Control container)
    {
        boolValue = new CheckBox();
        boolValue.ID = colname;
        container.Controls.Add(boolValue);
    }
    void boolValue_DataBinding(object sender, EventArgs e)
    {
        CheckBox cBox = (CheckBox)sender;
        GridDataItem container = (GridDataItem)cBox.NamingContainer;
    }
 
}


Class1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
 
/// <summary>
/// Summary description for Class1
/// </summary>
public class Class1
{
    public Class1()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public static DataTable GetDataTable()
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("ColumnID",typeof(Int32));
        dt.Columns.Add("ColumnUniqueName", typeof(string));
        dt.Columns.Add("ColumnControlID", typeof(string));
 
        dt.Rows.Add(1, "CheckBoxColumn1", "CheckBox1");
        dt.Rows.Add(2, "CheckBoxColumn2", "CheckBox2");
 
        return dt;
    }
}

Thanks,
Jayesh Goyani
ramesh
Top achievements
Rank 1
 answered on 19 Dec 2018
1 answer
89 views

Hi,

As per title, the issue able to reproduce in the demo site: https://demos.telerik.com/aspnet-ajax/editor/examples/overview/defaultcs.aspx

Step:

1. Open the 'Find And Replace' dialog.

2. Go to 'Replace' tab.

3. Find a word to replace.

4. In the Search Option, set the direction to 'Up'.

5. Click 'Replace All'.

A 'The search string was not found.' pop out even the string exists in the RadEditor. It only happens to 'Up' direction, 'Down' direction working fine.

Please help.

 

Thank you.

Rumen
Telerik team
 answered on 19 Dec 2018
5 answers
1.0K+ views
I have the following questions about the current Telerik DevCraft tool that you can download for a trial:
1. What version(s) of Visual Studio can be used with the most current Telerik DevCraft tool?
2. Would you tell me how to use the Telerik DevCraft with the different versions of Visual Studio?
   In order words:
   a. How would I have a Visual studio 2010 .net web form application utilize the the current Telerik DevCraft tool?
   b. How would I have a Visual studio 2016 or 2015 .net web form application utilize the the current Telerik DevCraft tool?
Thanks for answring my questions!
David
Top achievements
Rank 1
Iron
Veteran
Iron
 answered on 17 Dec 2018
1 answer
625 views

Hi, there!

I'm trying to get a calculated cell value from a RadSpreadsheet. The documentation says I can use the class FormulaCellValue, but it only works for Worksheets from the Telerik.Windows.Documents.Spreadsheet.Model package, or so it seems, because I use the following code:

Worksheet sheet = RadSpreadsheet1.Sheets[0];
foreach(Row row in sheet.Rows)
{
    ...
    string formula = row.Cells[3].Formula;
    Model.FormulaCellValue val = row.Cells[3].Value as Model.FormulaCellValue;
    ...
}

Here, Worksheet is from the Telerik.Web.Spreadsheet package. The variable formula gets the text of the formula right, but val is null. The cell is showing the result correctly on the spreadsheet. What is wrong here?

Thank you!

 

Peter Milchev
Telerik team
 answered on 17 Dec 2018
1 answer
142 views

Dear all, 

           I have a radgrid like follows:

           <telerik:RadGrid ID="uiGrid" runat="server"
                                        AutoGenerateColumns="false" ItemStyle-BackColor="White" AlternatingItemStyle-BackColor="White"
                                        OnDataBound="uiGrid_DataBound" OnItemDataBound="uiGrid_ItemDataBound" OnNeedDataSource="uiGrid_NeedDataSource"
                                        ClientSettings-ClientEvents-OnKeyPress="keyPressInGrid"
                                        Width="100%" Height="500">
                                        <ClientSettings>
                                            <Scrolling CountGroupSplitterColumnAsFrozen="false" AllowScroll="true" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="3"></Scrolling>

                                        </ClientSettings>
                                        <MasterTableView>
                                            <GroupByExpressions>
                                                <telerik:GridGroupByExpression>
                                                    <SelectFields>
                                                        <telerik:GridGroupByField FieldAlias="<%$ Resources:Resource,Group %>" FieldName="IndicatorParentName"></telerik:GridGroupByField>
                                                    </SelectFields>
                                                    <GroupByFields>
                                                        <telerik:GridGroupByField FieldName="IndicatorParentName" SortOrder="Ascending"></telerik:GridGroupByField>
                                                    </GroupByFields>
                                                </telerik:GridGroupByExpression>
                                            </GroupByExpressions>
                                            <Columns>
                                                <telerik:GridBoundColumn DataField="IndicatorName" HeaderText="<%$ Resources:Resource,Indicator %>" UniqueName="IndicatorName"
                                                    SortExpression="IndicatorName" DataType="System.String" ItemStyle-Wrap="false">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridTemplateColumn>
                                                    <ItemTemplate>
                                                        <asp:HiddenField ID="uiIndicatorID" runat="server" Value='<%#Eval("IndicatorID")%>' />
                                                        <asp:HiddenField ID="uiIndicatorName" runat="server" Value='<%#Eval("IndicatorName")%>' />
                                                        <asp:ImageButton ID="uiTipsButton" runat="server" ImageUrl="images/information-icon.png?20170703" Width="16" Height="16" />
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                                <telerik:GridTemplateColumn HeaderText="<%$ Resources:Resource,Unit %>">
                                                    <ItemTemplate>
                                                        <asp:Label ID="uiUnit" runat="server" />
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                            </Columns>
                                        </MasterTableView>
                                    </telerik:RadGrid>

 

And I have functions to find controls value like this :

 

           foreach (GridDataItem item in uiGrid.MasterTableView.Items)
            {
                if (item.ItemType == GridItemType.Item || item.ItemType == GridItemType.AlternatingItem)
                {
                    HiddenField uiIndicatorID = item.FindControl("uiIndicatorID") as HiddenField;
                    for (int i = 0; i < uiGrid.MasterTableView.Columns.Count; i++)
                    {
                        HiddenField uiLocationID = item.FindControl("uiID_" + i.ToString()) as HiddenField;
                        RadNumericTextBox uiCurrencyBox = item.FindControl("uiCurrencyBox_" + i.ToString()) as RadNumericTextBox;
                        RadNumericTextBox uiInputBox = item.FindControl("uiInputBox_" + i.ToString()) as RadNumericTextBox;
                        HiddenField uiRemarksBox = item.FindControl("uiRemarksBox_" + i.ToString()) as HiddenField;

 

Now I want is not to loop the GridIitem to do the processing, I want to do the processing when user leave each inputbox (inside the grid) event happened. So I added the follows , in the InstantiateIn I add a delegation txt_TextChanged to the TextChanged event of _inputbox.

public void InstantiateIn(System.Web.UI.Control container)

             _inputBox = new RadNumericTextBox();
            _inputBox.ID = "uiInputBox_" + _controlIDNumber;
            _inputBox.Width = Unit.Pixel(100);

            UsageEdit ue = new UsageEdit(); //UsageEdit is another class
            _inputBox.TextChanged += ue.txt_TextChanged;

So in UsageEdit Class, I have the function 

            public void txt_TextChanged(object sender, EventArgs e)
        {
            
        }

My question is, how can I get the control value in function. like something:

    public void txt_TextChanged(object sender, EventArgs e)
        {

             HiddenField uiIndicatorID = sender.FindControl("uiIndicatorID") as HiddenField;
                    for (int i = 0; i < uiGrid.MasterTableView.Columns.Count; i++)
                    {
                        HiddenField uiLocationID = sender.FindControl("uiID_" + i.ToString()) as HiddenField;
                        RadNumericTextBox uiCurrencyBox = sender.FindControl("uiCurrencyBox_" + i.ToString()) as RadNumericTextBox;
                        RadNumericTextBox uiInputBox = sender.FindControl("uiInputBox_" + i.ToString()) as RadNumericTextBox;
                        HiddenField uiRemarksBox = sender.FindControl("uiRemarksBox_" + i.ToString()) as HiddenField;            
        }

Can I do that, can I access the control of the grid item in leave event of the inputbox that is in the grid item?

 

Eyup
Telerik team
 answered on 17 Dec 2018
1 answer
443 views

Hello

It seems by default, RadGrid applies client-side filtering on columns. When I press enter on a column, I can see at the end, client side filter is being applied. Is there any property to disable it? Here is a sample:

<telerik:RadGrid AutoGenerateColumns="False" ID="grdInProgressTasks" runat="server" Width="100%" AllowMultiRowSelection="true" AllowSorting="true"
                AllowPaging="true" OnNeedDataSource="grdInProgressTasks_NeedDataSource" CssClass="grdTasks pro-responsive" OnItemDataBound="GrdInProgressTasks_ItemDataBound"
                OnItemCommand="grdInProgressTasks_ItemCommand">
                <MasterTableView DataKeyNames="CrmObjectId,ProcessInstanceTypeIndex,Description, ColorR,ColorG,ColorB" ClientDataKeyNames="Id,CrmObjectId,ProcessInstanceTypeIndex" AllowCustomPaging="true" AllowFilteringByColumn="true" >
                    <Columns>
                        <septa:LocalizedBoundColumn DataField="DSenderId" HeaderResourceKey="General.Literal.AssignedFrom" />
                        <septa:LocalizedBoundColumn DataField="CrmObjectSubject" HeaderResourceKey="General.Literal.General_Subject" />
                        <septa:LocalizedTemplateColumn DataField="NickName" HeaderResourceKey="General.Literal.CrmHistory_IdentityName">
                            <ItemTemplate>
                                <a href="/_SiteCommon/Handler/IdentityFinder.ashx?Id=<%# Eval("IdentityId") %>" target="_blank"><%# Eval("NickName") %></a>
                            </ItemTemplate>
                        </septa:LocalizedTemplateColumn>
                        <septa:LocalizedGridDataBoundColumn DataField="DRelatedToId" HeaderResourceKey="General.Literal.erja" />
                        <septa:LocalizedGridDataBoundColumn DataField="DRelatedToTypeIndex" HeaderResourceKey="General.Literal.ReferType" AllowSorting="false" />
                        <septa:LocalizedGridDataBoundColumn DataField="DCardtableStatusIndex" HeaderResourceKey="General.Literal.Status" AllowSorting="false" />
                        <septa:LocalizedGridDataBoundColumn DataField="DDoneCauseIndex" HeaderResourceKey="General.Literal.End" AllowSorting="false" />
                        <septa:LocalizedBoundColumn DataField="CreateDatePersian" HeaderResourceKey="General.Literal.CreateDate" />
                        <septa:LocalizedGridDataBoundColumn DataField="LifePathType" HeaderResourceKey="General.Literal.Type" AllowSorting="false" />
                    </Columns>
                    <NoRecordsTemplate>
                        <div class="clearfix text-center">
                            <septa:LocalizedLiteral runat="server" ResourceKey="Res.General.Literal.UcUserTasks_AnyCaseDefined"></septa:LocalizedLiteral>
                        </div>
                    </NoRecordsTemplate>
                </MasterTableView>
                <ClientSettings EnableRowHoverStyle="true" EnableAlternatingItems="false" AllowDragToGroup="True" AllowColumnsReorder="True">
                    <Selecting AllowRowSelect="true" EnableDragToSelectRows="true" />
                    <ClientEvents OnRowDblClick="RowDblClick" OnRowContextMenu="onRowContextMenu" />
                    <Resizing AllowColumnResize="true"></Resizing>
                </ClientSettings>
            </telerik:RadGrid>

 

And here is my columns:

public class LocalizedBoundColumn : GridBoundColumn
{
    public LocalizedBoundColumn()
    {
        this.AutoPostBackOnFilter = true;
        this.CurrentFilterFunction = GridKnownFunction.Contains;
        this.AutoPostBackOnFilter = true;
        this.ShowFilterIcon = false;
    }

 

    // ... 

}
Attila Antal
Telerik team
 answered on 14 Dec 2018
1 answer
108 views

- Click on an image

- Scroll

Rumen
Telerik team
 answered on 14 Dec 2018
9 answers
262 views
Hi,

I want to make use of the RAD Window control just to open up my different forms where all the functionality will be on my various forms and i can show them in RAD Window control rather than in a normal popup window. This approach will help me get rid of the popup blocker problem which falls in with the normal popup window approach. Also i want to have the looks of these RAD Windows on my popup screens.

Kindly assist ASAP.

Thanks, 
Sunil Nahar.
Marin Bratanov
Telerik team
 answered on 14 Dec 2018
11 answers
703 views
Hi,

We have a very tall form with a href links throughout. If a  user scrolls down, and clicks a link, this opens a radwindow. We are getting the current x and y pos of the mouse so that we set the radwindow position to something relative to where the mouse is - the goal being to just have the window appear wherever you are at in the position of the screen. However, when the radwindow opens, the browser resets the scroll position so we are looking at the top of the page - with our radwindow way down and invisible.

How can we open a rad window, and set its position but not have the browser scroll back to the top (we are using Firefox 3.5.3 in tests) ? Here is our code. Thanks in advance!

 function openRadWindow(ESID) {
            var oWnd = radopen("ViewFaculty.aspx?ESID=" + ESID, null);
            oWnd.SetSize(600, 550);
           // tempX and tempY are the current mouse x and y positions
            oWnd.moveTo(tempX, tempY);
            return false;


        }
Marin Bratanov
Telerik team
 answered on 14 Dec 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?