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

So, after google-ing for about 6 hours or so I finally gave up. Hope someone here can hook me up with advice.

I'm creating a dynamic function for all grids in my DNN module. ​When I double click on a row, I call the function editKey, which takes in parameter grid and fetches its ID (For now I only have two grids, but that is not the issue). ​Then it fetches all the information about that row​ and a new RadWindow opens up where the prefetched information can be seen and/or managed/deleted.
As I open a new window, I load a new <div> inside it which serves as a template for each grid. The strange thing is, when I add the div to the server (runat="server) I cant seem to find it with the $find('<% ​CodaEdit1  %>') call.

 I want to use all of my prefetched info and put it into this div. My first thought of accessing the divs elements was to use something like

document.getElementById("CodaEdit1").children[i].setAttribute("Text", info[i]);

But that does not do anything.
Neither can I access the first element in the div with

document.getElementById("FindMe");​

but

var re = $find('<%= FindMe.ClientID %>');
        re.set_value("this works");

Works perfectly. I can of course write the find function for each and every radtextbox that I have, but my code will look pretty ugly and scale terrible as my project grows.​

Here is the referenced code

 

<div id="CodaEdit1" style="display:none">
        <telerik:RadTextBox ID="FindMe" runat="server" Label="Rule" Text=""></telerik:RadTextBox>
         
</div>
 
<script type="text/javascript">
     
    var keySelected;
 
    function editKey(sender)
    {
        var whichLayout = windowLayout(sender);
        var grid, divinsert;
 
        switch(whichLayout)
        {
            case ("1"):
                grid = $find('<%= RadGrid1.ClientID %>');
                break;
            case ("2"):
                grid = $find('<%= RadGrid2.ClientID %>');
                break;
        }
        divinsert = $get("CodaEdit"+whichLayout);
 
        var masterTableView = grid.get_masterTableView();
        keySelected = rowInfo(masterTableView);
 
        //alert(document.getElementById("CodaEdit1").children[0]); <-- HTMLELEMENTSPAN
        document.getElementById("CodaEdit1").children[0].setAttribute("Text", "Goon"); <-- Does nothing
 
        var editWindow = GetRadWindowManager().open(null, null, divinsert, 1200, 200);//; 10, 10);
        editWindow.center();
 
//alert(document.getElementById("CodaEdit1").children[0].textContent); <-- finds the text content
 
 
        var re = $find('<%= FindMe.ClientID %>');
        re.set_value("#gfdgdfgsd");
         
 
    }
 
    function windowLayout(gridSender)
    {
        var layoutType = gridSender.get_id();
        return layoutType.charAt(layoutType.length - 1);
         
    }
 
    function rowInfo(aTableView)
    {
        var selectedItems = aTableView.get_selectedItems();
        var row = selectedItems[0];
         
        var columns = aTableView.get_columns();
        var resultArray = [];
        for (var i = 0; i < columns.length; i++)
        {
            var category = columns[i].get_uniqueName();
            var cellValue = $(row.get_cell(category)).text();
 
            resultArray.push(cellValue);
        }
        return resultArray;
    }
</script>

 

<telerik:RadGrid ID="RadGrid1"
        runat="server"
        AllowPaging="True"
        AllowSorting="True"
        DataSourceID="​blablablawooo"
        GroupPanelPosition="Top"
        ShowGroupPanel="True"
        EnableLinqExpressions="False"
        AllowFilteringByColumn="True"
        OnInit="RadGrid1_Init"
        OnItemCommand="RadGrid1_ItemCommand"
        OnPreRender="RadGrid1_PreRender"
        Height="600px">
        <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True" EnableRowHoverStyle="True">
            <Selecting AllowRowSelect="True" />
            <Scrolling AllowScroll="True" EnableVirtualScrollPaging="True" />
            <Resizing AllowColumnResize="True" />
            <ClientEvents OnFilterMenuShowing="filterMenuShowing" OnRowDblClick="editKey"/>
        </ClientSettings>

        <MasterTableView AutoGenerateColumns="False" DataKeyNames="RULE_ID" DataSourceID="its a secret yo">
            <Columns>
                <telerik:GridBoundColumn AllowFiltering="False" DataField="RULE_ID" DataType="System.Decimal" FilterControlAltText="Filter RULE_ID column" HeaderText="RULE ID" ReadOnly="True" SortExpression="RULE_ID" UniqueName="RULE_ID">
                </telerik:GridBoundColumn>

etcetc...​

IT-Fjárvakur
Top achievements
Rank 1
 answered on 12 Aug 2015
1 answer
569 views

We have just started using UI for ASP.NET AJAX. Everything works fine until we try using client-side code. We keep receiving this error : "JavaScript runtime error : '$telerik' is undefined". I've searched for a solution online but none of the suggested solutions works.

 

At the moment our web.config has the following entries which according to online sources would solve the problem but didn't :

 <location path="Telerik.Web.UI.WebResource.axd">
  <system.web>
    <authorization>
      <allow users="*"/>
    </authorization>
  </system.web>
</location>

<system.web>
  <httpHandlers>
    <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />        
  </httpHandlers>
</system.web>

<system.webServer>
  <handlers>
    <add name="Telerik.Web.UI.WebResource"  path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2014.2.724.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" />
  </handlers>
</system.webServer>

 We also tried the following to no avail :

<system.webServer>
  <handlers>
    <add name="Telerik_Web_UI_WebResource_axd" verb="*" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" preCondition="integratedMode" />
  </handlers>
</system.webServer>

In default.aspx we have the following :

 

        <telerik:RadScriptManager ID="scriptManagerMain" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
            <Services>
                <asp:ServiceReference Path="~/WCF/DataService.svc"/>
            </Services>            
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="radAjaxManagerMain" runat="server">
        </telerik:RadAjaxManager>

With all these settings we still keep receiving the "JavaScript runtime error : '$telerik' is undefined" error.​ I really hope someone knows the solution to this problem because we're stick here and can't find a solution. Thanks in advance for any help.

 

Viktor Tachev
Telerik team
 answered on 12 Aug 2015
1 answer
89 views

I have a RadGrid and a RadComboBox outside of RadGrid (say comboOutside), inside a Web Form.
Inside RadGrid, there is 1 more RadComboBox (say comboRadGrid). On selection of items from comboOutside, comboRadGrid is bind i.e., If item 'Company' is selected from comboOutside, then all the company names will be bind in comboRadGrid; and then user select specific company from comboRadGrid and records are added in RadGrid.

For all items, functionality is working fine but I am facing issue in binding of a specific comboOutside item. i.e., When I choose a specific item from comboOutside, say I have 100 items inside comboOutside, and when I select 35th items from it, then comboRadGrid always throw this error while binding records for 35th item (since 35th item has 2000+ records to bind in comboRadGrid)
Error is attached below: 
Funcitonality is working fine for all the items except 1 specific item of RadComboBox. I don't understand why. Due to this I am unable to add records in RadGrid
Below is my code- 

C# code​​

public DataTable GetAccCode(string CompanyCode)
    {
        SqlConnection con = new SqlConnection(strcon);
        SqlCommand cmd = new SqlCommand("[Invoice].[usp_tbl_AccountCode_DL_Test]", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@CompanyCode", CompanyCode);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        try
        {
            con.Open();
            da.Fill(dt);
            con.Close();
        }
        catch (Exception ex)
        {
        }
        return dt;
    }
protected void RGGSTAcCode_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            //bind dropdwon while "Add"
            string CompanyCode = ddlCompany.SelectedValue.ToString();
            GridEditableItem item = (GridEditableItem)e.Item;
  
            //code to bind inside RadComboBox list 
            RadComboBox rcb = (RadComboBox)item.FindControl("ddlAccountCode");
            rcb.DataSource = GetAccCode(CompanyCode);
            rcb.DataTextField = "AccountDescription";
            rcb.DataValueField = "AccountCodeID";
            rcb.DataBind();
            rcb.Items.Insert(0, new RadComboBoxItem("- Select -", string.Empty));
  
            Session["AccCode"] = rcb.SelectedValue.ToString();
            string a = rcb.SelectedValue.ToString();
  
            //Select particular dropdown value while "Edit"
            Label lblAcCode2 = item.FindControl("lblAcCode2") as Label;
            if (!string.IsNullOrEmpty(lblAcCode2.Text))
            {
                rcb.SelectedValue = lblAcCode2.Text;
                rcb.SelectedItem.Text = lblAcCode2.Text;
            }
        }
    }
     //code to bind outside RadComboBox list
        protected void BindComapnyDL()
        {
            SqlConnection con = new SqlConnection(strcon);
            SqlCommand cmd = new SqlCommand("General.usp_tbl_BuyerCode_Query", con);
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataTable dt = new DataTable();
            try
            {
                con.Open();
                da.Fill(dt);
                con.Close();
            }
            catch (Exception ex)
            {
            }
  
            ddlCompany.DataTextField = "Title";
            ddlCompany.DataValueField = "Code";
            ddlCompany.DataSource = dt;
            ddlCompany.DataBind();
  
            Session["Comp"] = ddlCompany.SelectedValue.ToString();
            string a = ddlCompany.SelectedValue.ToString();    
        }
  
        //RadComboBox select index changed event
        protected void ddlCompany_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            if (ddlCompany.SelectedValue == null || ddlCompany.SelectedValue == "")
            {
                GridCommandItem cmditem = (GridCommandItem)RGGSTAcCode.MasterTableView.GetItems(GridItemType.CommandItem)[0];
                System.Web.UI.WebControls.Button ctrl = (System.Web.UI.WebControls.Button)cmditem.FindControl("AddNewRecordButton");
                ctrl.Enabled = false;
  
                System.Web.UI.WebControls.LinkButton btn = (System.Web.UI.WebControls.LinkButton)cmditem.FindControl("InitInsertButton");
                btn.Enabled = false;
  
                string content = "Please select company first";
                ScriptManager.RegisterStartupScript(this, typeof(string), "Successful", "alert('" + content + "');", true);
            }
            else
            {
                RGGSTAcCode.Rebind();
            }
        }

HTML Code: 

<telerik:RadComboBox ID="ddlCompany" runat="server" Height="200" Width="240"
          DropDownWidth="310" EmptyMessage="- Select Product -" HighlightTemplatedItems="true" CausesValidation="false"
          Filter="Contains" AppendDataBoundItems="true" AllowCustomText="true" AutoPostBack="true"
          DataTextField="Title" DataValueField="Code" OnSelectedIndexChanged="ddlCompany_SelectedIndexChanged">
        </telerik:RadComboBox>
  
<telerik:RadGrid ID="RGGSTAcCode" runat="server"
                   ShowFooter="True" GroupingEnabled="False" ShowStatusBar="true" EmptyDataText="No record available."
                   AllowAutomaticInserts="False" AllowAutomaticUpdates="False" AllowAutomaticDeletes="true"
                   OnNeedDataSource="RGGSTAcCode_NeedDataSource" OnItemDataBound="RGGSTAcCode_ItemDataBound"
                   OnInsertCommand="RGGSTAcCode_InsertCommand" OnDeleteCommand="RGGSTAcCode_DeleteCommand"
                   OnUpdateCommand="RGGSTAcCode_UpdateCommand" OnItemCommand="RGGSTAcCode_ItemCommand">
                  <mastertableview ShowHeadersWhenNoRecords="true" autogeneratecolumns="false" datakeynames="AccountCodeID" InsertItemDisplay="Top"
                    insertitempageindexaction="ShowItemOnCurrentPage" ShowFooter="True" CommandItemDisplay="Top" ClientIDMode="Static">                                 
                         <Columns>
                             <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"></telerik:GridEditCommandColumn>
  
                             <telerik:GridTemplateColumn UniqueName="AccountCode" HeaderText="Account Code">
                                <ItemTemplate>
                                  <asp:Label ID="lblAcCode" runat="server" Text='<%# Eval("AccountCode")%>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                   <asp:Label ID="lblAcCode2" runat="server" Text='<%# Eval("AccountCode") + " - " + Eval("AccountDescription")%>' Visible="false"></asp:Label>
  
                                   <telerik:RadComboBox ID="ddlAccountCode" runat="server" Height="200" Width="240"
                                       DropDownWidth="310" HighlightTemplatedItems="true" CausesValidation="true"
                                       Filter="Contains" AppendDataBoundItems="true" DataTextField="AccountDescription" DataValueField="AccountCodeID">
                                   </telerik:RadComboBox>
                                </EditItemTemplate>
                             </telerik:GridTemplateColumn>
  
                             <telerik:GridBoundColumn DataField="AccountDescription" HeaderText="Description" UniqueName="AccountDescription" SortExpression="AccountDescription" InsertVisiblityMode="AlwaysHidden" ReadOnly="true" ></telerik:GridBoundColumn>
                             <telerik:GridBoundColumn aggregate="SUM" DataField="Amount" HeaderText="Amount" FooterAggregateFormatString="Total : {0:###,##0.00}" DataFormatString="{0:n}" FooterStyle-BackColor="#ffc04c" UniqueName="Amount" SortExpression="Amount"></telerik:GridBoundColumn>
                             <telerik:GridBoundColumn DataField="Remark" HeaderText="IFCA Remark" UniqueName="Remark" SortExpression="Remark">
  
                             </telerik:GridBoundColumn>  
  
                             <telerik:GridButtonColumn ConfirmTextFormatString="Are you sure you want to Delete {0} Account Code?" ConfirmTextFields="AccountCodeID"
                             ConfirmDialogType="RadWindow" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"></telerik:GridButtonColumn>                                                                          
                      </Columns>
                      <EditFormSettings>
                         <EditColumn ButtonType="ImageButton" />
                      </EditFormSettings>
                      <CommandItemSettings AddNewRecordText="Add new record" RefreshText="Refresh"></CommandItemSettings>
                  </mastertableview>
                </telerik:RadGrid>

 Please let me know how to resolve. What shall I change in my code.
I have to populate/bind the RadComboBox (comboRadGrid) which is inside of RadGrid, based on the Items that are outside of RadGrid of RadComboBox (comboOutside). Please note that I am very new in Telerik and asp.net Please let me know how to modify my comboRadGrid binding code (based on outside Combo List items) so that this issue do not occur again ? Please reply​

 

 

Eyup
Telerik team
 answered on 12 Aug 2015
1 answer
44 views

What browsers are supported for copying and pasting images into RadEditor as Base64 images. I know that for IE only IE 11 is supported but what about for Chrome or Firefox? What are the minimum versions.

 Any help is appreciated. Thanks!

Vessy
Telerik team
 answered on 12 Aug 2015
1 answer
78 views

What browsers are supported for copying and pasting images into RadEdtor as Base64 images. I know that for IE only IE 11 is supported but what about for Chrome or Firefox? What are the minimum versions.

 Any help is appreciated. Thanks!

Vessy
Telerik team
 answered on 12 Aug 2015
3 answers
300 views

Hi,

I have listview that works well with the definition below:

<telerik:RadListView ID="lvwUserGroups" runat="server" ItemPlaceholderID="groupsPlaceholder" OnNeedDataSource="lvwUserGroups_NeedDataSource"
    DataKeyNames="GroupID" >
    <LayoutTemplate>
        <div class="RadListView RadListView_<%# Master.SkinManager.Skin %>" >
            <table class="mainTable">
                <thead>
                    <tr class="rlvHeader">
                        <th class="thcenter">Enabled</th>
                        <th>Group</th>
                    </tr>
                </thead>
                <tbody>
                    <asp:PlaceHolder id="groupsPlaceholder" runat="server">
                    </asp:PlaceHolder>
                </tbody>
            </table>
        </div>
    </LayoutTemplate>
</telerik:RadListView>

 

protected class userGRPTemplate : ITemplate
{
    private ADScrubWeb.HTMLHelper helper = new ADScrubWeb.HTMLHelper();
 
    public userGRPTemplate()
    {
    }
 
    public void InstantiateIn(Control container)
    {
        TableRow tr = new TableRow();
        container.Controls.Add(tr);
 
        helper.AddControlToParent(container, helper.AddBoundHiddenField("GroupID"));
 
        helper.AddControlToParent(tr, helper.AddBoundCheckBox("Enabled"), true, HorizontalAlign.Center);
        helper.AddControlToParent(tr, helper.AddBoundTextBox("GroupName", BorderStyle.None, true), true, HorizontalAlign.Left);               
    }
}

 

public CheckBox AddBoundCheckBox(string controlID)
{
    CheckBox tmp = new CheckBox();
    tmp.ID = controlID;
    tmp.DataBinding += delegate(object sender, EventArgs args)
    {
        CheckBox control = ((CheckBox)sender);
        RadListViewDataItem listViewDataItem = ((RadListViewDataItem)control.NamingContainer);
        control.Checked = lsuGeneral.IsTrue(DataBinder.Eval(listViewDataItem.DataItem, controlID).ToString());
    };
    return tmp;
}

 

I would like to react to the user clicking the bound checkbox so I can do auto-updates without the user clicking an update button. I tried wiring up the checkbox CheckedChange event in the ITemplate but that didn't fire, anyway I would still need to know which row's checkbox was clicked.

Any ideas?

 

 

 

Maria Ilieva
Telerik team
 answered on 12 Aug 2015
1 answer
55 views

Hi,

I have a couple of questions:

1. Is there a way to know when the ImageEditor is being closed by the user? i.e. when the user is clicking the cancel button or the X button?

2. When the ImageEditor is "closed", the underlying object is not yet disposed, is there a property of the object that can be used to check if it is closed ?

Thanks
Elie

We are using version 2014.1.403.35
IE 9

 

 

Vessy
Telerik team
 answered on 12 Aug 2015
2 answers
108 views
Hi everyone,


I am trying to use RadAutoCompleteBox in a Sharepoint Visual Web Part solution, so i use below code which is working in another asp.net web application.



<telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>

 <telerik:RadAutoCompleteBox runat="server" ID="RadAutoCompleteBox1" EmptyMessage="Please search name here" Delimiter=","
            DataSourceID="SqlDataSource1" DataTextField="StaffName" InputType="Text" Width="250px" DropDownWidth="240px" Style="float: left; height: 22px">
            <TextSettings SelectionMode="Single" />
        </telerik:RadAutoCompleteBox>

        <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="Data Source=CNDEVSQL1;Initial Catalog=SAVLEAVE_OFFLINE;Integrated Security=True"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT  [StaffName] FROM [SAVLEAVE_OFFLINE].[dbo].[Staffs]"></asp:SqlDataSource>



i found that if my aspx for sharepoint contains RadScriptManager , then this page will return yellow page.

while the other radcontrol is working if there is no RadScriptManager in aspx.

i also added correct web config in my sharepoint site.


      <SafeControl Assembly="Telerik.Web.UI, Version=2014.2.812.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TypeName="*" Safe="True" />
      <SafeControl Assembly="Telerik.Web.Design, Version=2014.2.812.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.Design" TypeName="*" Safe="True" />
      <SafeControl Assembly="Telerik.Web.UI.Skins, Version=2014.2.812.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI.Skins" TypeName="*" Safe="True" />


<httpHandlers>
      <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false"/>
      <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false"/>
      <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false"/>
      <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false"/>
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/>
    </httpHandlers>


i also registered telerik dll in visual studio command prompt. 


gacutil -i c:\Telerik\Telerik.Web.UI.dll

gacutil -i c:\Telerik\Telerik.Web.Design.dll

 


i think this is some issue of RadScriptManager for sharepoint? because radajax panel ,radgrid is working correctly in the same page if there is no RadScriptManager .


any help is much appreiated because this issue is troubling me for many days!!

Yang
Top achievements
Rank 1
 answered on 12 Aug 2015
3 answers
375 views
Hi

The users can delete rows in a radgrid by pressing the delete key from the keyboard. But there is no confirmation pop up to prevent the user from deleting the row by mistake. When users presses the delete key i use fireCommand("Cancel", "") to prevent the row from deleting. After that i want to display a radconfirm window but the radconfirm window pops up for a second only and goes away without allowing the user to press either Yes or No. How can I stop the radconfirm window from closing?

case 46: //Delete

                       
            if (!(event.srcElement.type == "text") && !(event.srcElement.type == "textarea")) {
                GetGrid().get_masterTableView().fireCommand("Cancel", "");                    
                radconfirm(prompt, clientCallBackFunc);
            }
            break;

Thanks
Muhammad

Maria Ilieva
Telerik team
 answered on 12 Aug 2015
2 answers
231 views

Hello,

is it somehow possible to sort the tasks e.g. by start date. It seems that it's only possible to sort the tasks inside the gantt by custom columns when using a custom gantt provider. Sorting by a standard column like title or start date is ignored. Thanks.

Regards,
Felix

Felix
Top achievements
Rank 1
 answered on 12 Aug 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?