Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
147 views
hi....
what i want simply i have two template fields in a gridview
one for   RadAsyncUpload  and other for a button 
what i want that i want to get RadAsyncUpload  that found in the same GridViewRow of the clicked button using jquery 

i tried something like this 
   var uploader = $(this).closest('td').prev().find(".MyClass");
but i doesn't get the control


Ahmed
Top achievements
Rank 1
 answered on 11 Aug 2013
2 answers
192 views
Hi guys, good day to you.

I've implemented an RadComboBox with multiple columns in an item template and using automatic load on demand on a very large dataset, and it is working very well.
However i have some questions I hope you can help me.

1) The combobox is implemented using Filer="Contains", and it searches across all the columns in the item template using ItemsPerRequest = "10". In order to achieve this, I've created a column in the datasource called "SearchColumn", which is a string consisting of "col1" + "col2"+"col3" etc.... The DataTextField is then set to DataTextField = "SearchColumn". This works very well and implements the search functionality that I want. But because the DataTextField is now this SearchColumn, whenever the user clicks an item, the text in the RadComboBox becomes this very long string. For example, if I have a row in the dropdown with columns - "Vehicle0001" "Car" "Blue" "4 wheels",my SearchColumn becomes "Vehicle0001CarBlue4Wheels", and if the user searches any of these columns the row will show up. Clicking on the item will set the text in the RadComboBox to "Vehicle0001CarBlue4Wheels". But this is not what I want to display as the text, so I have added a viewstate variable to store and display the selected value,

    RadComboBox_SelectedIndexChanged(Object sender, EventArgs e)
    {
      ViewState["SelectedVehicle"] = e.SelectedValue
    }

    and added a line in Page_PreRender to always set the text to the value to display.

    protected void Page_PreRender(object sender, EventArgs e)
    {
      RadComboBox.Text = ViewState["SelectedVehicle"]
    }

Is this the recommended way to implement a search across all columns and yet display a different text on selection? I am wondering if there is a property to set in the RadComboBox control to indicate which is the datafield to search ("SearchColumn"), or does it only search the DataTextField?

2) This method is working very well for me, but there is a small problem. If the user click the RadComboBox and expands the drop down, but does not change anything, it will auto set the value to the DataTextField ("Vehicle0001CarBlue4Wheels") and not "Vehicle0001" since there is no postback. What is the recommended way to resolve this?

3) I am hoping to replace the Page_Prerender server side setting the ViewState variable, with a client side set text setting after every SelectedIndexChanged. So I have tried something like this, changing the SearchColumn to be something like Col1+ '|' + Col2 .... so "Vehicle0001CarBlue4Wheels" becomes "Vehicle0001|Car|Blue|4Wheels", then I added OnClientSelectedIndexChanged function following the demo

    function RadComboBoxOnClientSelectedIndexChanged(sender, eventArgs) {
                var item = eventArgs.get_item();
                sender.set_text(item.get_text().split("|")[0]);
    }

But there is a problem, the RadComboBoxOnClientSelectedIndexChanged is called before server processes the server side function RadComboBox_SelectedIndexChanged. By calling sender.set_text(); on a custom value, the SelectedValue becomes "", it will never select the correct item. How should I resolve this? Is there a way to call set_text after server processes RadComboBox_SelectedIndexChanged?

Thanks for reading.
Joey
Top achievements
Rank 1
 answered on 10 Aug 2013
4 answers
218 views
I'm working on a custom calendar control that contains a RadCalendar.  The control is being used to display a monthly school calendar that shows in-session days, holidays, vacation days, etc.  I need to be able to add these items dynamically from codebehind so I can add text and color code the items, etc.  I'm using the ITemplate interface to add CalendarDayTemplates as described in this post.  

Unfortunately, I've run into what appears to be a bug.  Accessing the calendar's CalendarView.ViewStartDate or CalendarView.ViewEndDate properties from the calendar's Init event completely breaks calendar navigation.  I have tried adding the  CalendarDayTemplates in the calendar's Prerender event but it appears that this is too late in the control's lifecyle as I get the following exception:

Server Error in '/' Application.

Template with ID: 02202012 not found.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Template with ID: 02202012 not found.

If have confirmed that the issue is not with my code by stripping out everything but code that accesses CalendarView.ViewStartDate or CalendarView.ViewEndDate properties.

Here's how to reproduce the problem:

aspx code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default2.aspx.cs" Inherits="NLGOnLineTestClient.default2" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!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>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <telerik:RadCalendar ID="RadCalendar1" runat="server" AutoPostBack="True" oninit="RadCalendar1_Init">
        </telerik:RadCalendar>
            </div>
    </form>
</body>
</html>



codebehind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace NLGOnLineTestClient
{
    public partial class default2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
 
        protected void RadCalendar1_Init(object sender, EventArgs e)
        {
            string range = string.Format("Start: {0}  End {1}", RadCalendar1.CalendarView.ViewStartDate.ToString("g"), RadCalendar1.CalendarView.ViewEndDate.ToString("g"));
            System.Diagnostics.Debug.WriteLine(range);
        }
    }
}


When running this, note that you can only move one month forward and one month back from the current month.  Attempting to navigate additional months has no effect.  Looking at FireBug's script tag show no errors.

The very bad news is that I was close to 2 days into working on getting this working and styled when I discovered this problem.  Any suggestions or word arounds would be VERY appreciated.

Thanks -- Steve

Mahendra
Top achievements
Rank 1
 answered on 10 Aug 2013
2 answers
299 views
Hello,

On the following menu demo:

http://demos.telerik.com/aspnet-ajax/menu/examples/functionality/templates/defaultcs.aspx

On the last item, the "login", mousing over causes a small form to be displayed for the user to log in.  I want to align that slide-out panel with the RIGHT side of the "login" item instead of the left (because the menu will be aligned on the right side of the page).  How do I do this?

Thank you!

Lisa
Top achievements
Rank 1
 answered on 09 Aug 2013
4 answers
700 views
http://www.telerik.com/help/aspnet-ajax/grid-performing-batch-updates.html

I'm trying to use the example in that demo to allow someone to edit multiples rows in a grid and then submit the changes all at once. However, I keep getting the following error:

Unable to cast object of type 'Telerik.Web.UI.GridCommandItem' to type 'Telerik.Web.UI.GridEditableItem'


I'm not sure what's wrong here. In my Radgrid1_ItemCommand function I've left out ALL of the code - it's just an empty function that does nothing. and i still get the above error. Any suggestions?

ASPX
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" DataSourceID="SqlDataSource1" GridLines="None" AutoGenerateEditColumn="True" AllowMultiRowEdit="True" Width="40%" OnPreRender="RadGrid1_PreRender" AllowAutomaticUpdates="True" OnItemCommand="RadGrid1_ItemCommand" >
<MasterTableView AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1" EditMode="InPlace" CommandItemDisplay="Top">
 
    <CommandItemTemplate>
        <asp:LinkButton ID="btnUpdate" runat="server" CommandName="Update" Visible='true' Text="Update" Font-Bold="True" Font-Size="Larger" />
    </CommandItemTemplate>
 
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
 
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column" Created="True">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
 
    <Columns>
        <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Name column" HeaderText="Name" SortExpression="Name" UniqueName="Name">
        </telerik:GridBoundColumn>
        <telerik:GridCheckBoxColumn DataField="IsParent" DataType="System.Boolean" FilterControlAltText="Filter IsParent column" HeaderText="IsParent" SortExpression="IsParent" UniqueName="IsParent">
        </telerik:GridCheckBoxColumn>
    </Columns>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
 
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
</MasterTableView>
 
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MachineSalesConnectionString1 %>" SelectCommand="SELECT [ID], [Name], [IsParent] FROM [Manufacturer]" UpdateCommand="UPDATE [Manufacturer] SET [Name] = @Name, [IsParent] = @IsParent WHERE [ID] = @ID">
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="IsParent" Type="Boolean" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="IsParent" Type="Boolean" />
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>

CS
using System;
using Telerik.Web.UI;
 
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void RadGrid1_PreRender(object sender, System.EventArgs e)
    {
        if (!IsPostBack)
        {
            foreach (GridItem item in RadGrid1.MasterTableView.Items)
            {
                if (item is GridEditableItem)
                {
                    GridEditableItem editableItem = item as GridDataItem;
                    editableItem.Edit = true;
                }
            }
            RadGrid1.Rebind();
        }
    }
 
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
    {
    //    if (e.CommandName == "UpdateAll")
    //    {
    //        foreach (GridEditableItem editedItem in RadGrid1.EditItems)
    //        {
    //            Hashtable newnewValues = new Hashtable();
    //            //The GridTableView will fill the values from all editable columns in the hash 
    //            e.Item.OwnerTableView.ExtractValuesFromItem(newnewValues, editedItem);
    //            SqlDataSource1.UpdateCommand = String.Format("Update Manufacturers SET IsParent={0} WHERE ID={1}", newnewValues["IsParent"], editedItem["ID"].Text);
    //            SqlDataSource1.Update();
    //            editedItem.Edit = false;
    //        }
    //    }
    //    RadGrid1.Rebind();
    }  
}

ian lipsky
Top achievements
Rank 1
 answered on 09 Aug 2013
2 answers
131 views

Several of the formatting functions like alignment, numbering, tabbing, font style or size, spell check, etc. do not work intermittently. 

Once radEditor is opened and I type in the following:

This is the Request Search screen.
You can search for requests in this screen

  1. one
  2. two
  3. three


Now 
I put my cursor after the third bullet item and pressed enter twice for a new line. Then I typed in a couple of words, highlighted them with my mouse and clicked the icon to center the text. Nothing happened but if I click a different tab on my asp page, click radEditor again, highlight the text and click the icon to center the text it works. 

This  behavior is mostly noticed on pages that also have Telerik Treeview navigation on them. Is there a known conflict between Telerik Treeview and RadEditor?

Also this issue cannot be replicated when I run locally on my machine but can be seen on our Development and UAT server.

Another issue we noticed is that when RadEditor window is moved around, you can see the Treeview navigation through it.

I have attached the screenshots.

Here are code snippets:

Site.master:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="Wf.Sparc.Web.SiteMasterPage" %>
<%@ Register TagPrefix="ajaxToolkit" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

                                         <td valign="middle" class="rightblock">&nbsp;&nbsp; 
                            <asp:LinkButton ID="HelpPageView" runat="server" Text="View Help |" Font-Underline="true" 
                                toolTip="View information related to this page" ></asp:LinkButton>
                            
                            <asp:Panel ID="ModalPanelView" runat="server" style="display:none; width:380px; height:330px; background-color:White; 
                            border-width:2px; border-color:Black; border-style:solid; padding:20px;" > 
                            <asp:Button ID="OKButton" runat="server" Text="Close" ForeColor="Black"  /> <br /><br />
                            <telerik:RadEditor ID="radBodyView" ToolbarMode="Default" ToolsFile="~/RadControls/ToolsFile.xml" runat="server"
                                 ContentFilters="RemoveScripts" EditModes="All" Height="250" SkinID="RadEditorSkin" Enabled="false" 
                                  BackColor="LightGray"   Width="380" EnableResize="true" style="text-align: left; overflow:auto " />
                                    <script type="text/javascript">
                                        //This script must be below the RadEditor declaration
                                        //It displays the custom toolbar icon formatting FAQ
                                        //It replaces embedded scripts from a previous version of Telerik RadEditor     
                                        Telerik.Web.UI.Editor.CommandList["FormattingFAQ"] = function (commandName, editor, args) {
                                            var args = editor.get_html(true) //returns the HTML of the selection. 
                                            editor.showExternalDialog("/RadControls/FormattingFAQ.aspx", args, 500, 470, null, null, "Formatting FAQ",
                                                true, Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move, true, true); };
                                        Telerik.Web.UI.RadEditor.prototype._markExistingEmptyParagraphs = function (content) {
                                            return content;
                                        }
                                        Telerik.Web.UI.RadEditor.prototype._fixBrokenParagraphs = function (content) {
                                            return content;
                                        }
                                    </script>
                                <br /><br />
                        </asp:Panel>
                        
                            <ajaxToolkit:ModalPopupExtender ID="modalView" runat="server" TargetControlId="HelpPageView" PopupControlID="ModalPanelView"  
                            OkControlID="OKButton" />
                        
                            <asp:LinkButton ID="HelpPageEdit" runat="server" Text=" Edit Help |" Font-Underline="true"  
                            toolTip="Edit information related to this page" ></asp:LinkButton>

                            <asp:Panel ID="ModalPanelEdit" runat="server" style="display:none; width:480px; height:330px; background-color:White; 
                            border-width:2px; border-color:Black; border-style:solid; padding:20px;" Enabled="true"> 
                            <asp:Button ID="ButtonEdit" runat="server" Text="Close" ForeColor="Black"  /> <br /><br />

                            <telerik:RadEditor ID="radBodyEdit" ToolbarMode="Default" ToolsFile="~/RadControls/ToolsFile.xml" runat="server" Enabled="true"
                            ContentFilters="RemoveScripts" EditModes="All" Height="250" SkinID="RadEditorSkin" Width="100" EnableResize="true" />
                                    <script type="text/javascript">
                                        //This script must be below the RadEditor declaration
                                        //It displays the custom toolbar icon formatting FAQ
                                        //It replaces embedded scripts from a previous version of Telerik RadEditor     
                                        Telerik.Web.UI.Editor.CommandList["FormattingFAQ"] = function (commandName, editor, args) {
                                            var args = editor.get_html(true) //returns the HTML of the selection. 
                                            editor.showExternalDialog("/RadControls/FormattingFAQ.aspx", args, 500, 470, null, null, "Formatting FAQ",
                                                true, Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move, true, true); };
                                        Telerik.Web.UI.RadEditor.prototype._markExistingEmptyParagraphs = function (content) {
                                            return content;
                                        }
                                        Telerik.Web.UI.RadEditor.prototype._fixBrokenParagraphs = function (content) {
                                            return content;
                                        }
                                    </script>
                                <br /><br />
                                <asp:Button ID="SaveButtonEdit" runat="server" Text="Save" ForeColor="Black" OnClick="saveHelpContent"/> 
                            <asp:Button ID="CancelButtonEdit" runat="server" Text="Cancel" ForeColor="Black"  /> <br /><br /> <br /><br />
                        </asp:Panel>
                                <ajaxToolkit:ModalPopupExtender ID="PopupEdit" runat="server" TargetControlId="HelpPageEdit" PopupControlID="ModalPanelEdit" 
                            CancelControlID="CancelButtonEdit" OkControlID="ButtonEdit" PopupDragHandleControlID="ModalPanelEdit"/>

 

-----------------------------------------------------------------------------
site.master.cs

 protected void saveHelpContent(object sender, EventArgs e)
        {
            string pagePath = System.Web.HttpContext.Current.Request.Path.ToString();
            bool pagePathfound = DbAccess.SparcHelpPathCheck(pagePath);
            if (pagePathfound == false)
                {
                    Wf.Sparc.DAL.DbAccess.UpdSparcHelpContent("ins", pagePath, radBodyEdit.Content, int.Parse(Session["userid"].ToString()));
                    HelpPageView.Visible = true;
                    radBodyView.Content = radBodyEdit.Content;
                }
            else
                {
                    Wf.Sparc.DAL.DbAccess.UpdSparcHelpContent("upd", pagePath, radBodyEdit.Content, int.Parse(Session["userid"].ToString()));
                    radBodyView.Content = radBodyEdit.Content;
                }
        }

        protected string GetRadEditorContent()
        {
            string pagePath = System.Web.HttpContext.Current.Request.Path.ToString();
            string RadContent =  DbAccess.GetSparcHelpContent(pagePath).ToString();
            return RadContent;
        }

 

protected void Page_Load(object sender, EventArgs e)
        {

 //For View/Edit help link
            string pagePath = System.Web.HttpContext.Current.Request.Path.ToString();
            bool pagePathfound = DbAccess.SparcHelpPathCheck(pagePath);
            
            if (!IsPostBack)
            {
                radBodyView.Content = GetRadEditorContent();
                radBodyEdit.Content = GetRadEditorContent();
            }

            if (isHelpAdmin)
            {
                if (pagePathfound == false) 
                {
                    HelpPageEdit.Visible = true;
                    HelpPageView.Visible = false;
                }
                else
                {
                    if ((radBodyEdit.Content == "") || (radBodyEdit.Content == "<P>&nbsp;</P>"))
                    {
                        HelpPageEdit.Visible = true;
                        HelpPageView.Visible = false;
                    }
                    else
                    {
                        HelpPageEdit.Visible = true;
                        HelpPageView.Visible = true;
                    }
                }
            }
            else
            {
                if (pagePathfound == false)
                {
                    HelpPageEdit.Visible = false;
                    HelpPageView.Visible = false;
                }
                else
                {
                    if ((radBodyEdit.Content == "") || (radBodyEdit.Content == "<P>&nbsp;</P>"))
                    {
                        HelpPageEdit.Visible = false;
                        HelpPageView.Visible = false;
                    }
                    else
                    {
                        HelpPageEdit.Visible = false;
                        HelpPageView.Visible = true;
                    }
                }
            }
        }

Archna
Top achievements
Rank 1
 answered on 09 Aug 2013
6 answers
430 views
Hi,

How can I get the selected cell value from this event in JS? Seems like this should be documented in the manual, but I am not seeing it.

I tried this (after looking at other threads):

function Test_OnCellSelected(sender, args) {
    var gridDataItem = args.get_gridDataItem();
    var cell = gridDataItem.get_cell();
}

But i get "Microsoft JScript runtime error: 'undefined' is null or not an object" for the get_cell().

Thanks
kernelk
Top achievements
Rank 1
 answered on 09 Aug 2013
3 answers
137 views
I have 3 RadMaskedTextBox controls in a web user control. I want to use a client side java script function to clear any entered data on a button click. I use
var maskedTextBox = document.getElementById('<%=uxPhoneNumber.FindControl("uxAreaCode").ClientID %>');
if (maskedTextBox != null) {
    maskedTextBox.set_value("");
}
to find the controls (just showing the first control), and that is returning an HTMLelement object. When I try to use either the get_value(), or set_value() methods I get a JavaScript runtime error such as, "0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'set_value'". What am I doing wrong?
A2H
Top achievements
Rank 1
 answered on 09 Aug 2013
2 answers
63 views
Hello everyone,
I have enabled grouping in my radscheduler, so when I move appointment to another column I need to get it resource key. In RadScheduler1_AppointmentUpdate I have the same Resource key both for Appointment and ModifiedAppointment. I tried to add actual Resource key from get_targetSlot() as custom attribute for appointment, but it also unavailable on the server side. What is the correct way to pass actual resource key for moved  appointment?

Thanks
Vadim
Top achievements
Rank 1
 answered on 09 Aug 2013
1 answer
71 views
Hey, 

I have a RadGrid that I wanted to ajaxify, so I put a RadAjax panel around the radgrid.  This causes the RadGrid to be ajaxified.  Every row of this RadGrid has a radgrid itself, and some usercontrols in another cell.  When I update the model of the radgrid inside the radgrid, the grids aren't updated through ajax, but cause a full postback instead.  The same is for the user controls inside the radgrid.  Any easy way to make the inside radgrid's update through ajax as well as the parent radgrid?  

Let me know if some code would be better to look at.

Thanks
Konstantin Dikov
Telerik team
 answered on 09 Aug 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?