Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
129 views
I have a weird quirk, and I am trying to figure out how to prevent it.  I have an EditTemplate on my radgrid with a radeditor.  This radeditor seems to be modifying my comments even if I don't actually type anything new.  I'm trying to trap when users don't actually make a comment change, but that trap is being passed over with this quirk.  I am attaching a picture of the differences as they appeared in the VS Text Visualizer.  It shows that though they look very similar, there are some subtle differences, like magic carriage returns.  Again, I am not typing anything new into the content area.  I just click the edit button, then the update button.  There should be no difference.  (But there is)

Here is the code for this:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"
                        AllowPaging="True" AllowSorting="True" GridLines="None" Skin="WebBlue"
                        OnNeedDataSource="RadGrid1_NeedDataSource"
                        OnDataBound="RadGrid1_DataBound" width="100%"
                        AutoGenerateColumns="False">
                        <ExportSettings  ExportOnlyData="True" IgnorePaging="true" OpenInNewWindow="true">
                            <Excel Format="ExcelML" />
                        </ExportSettings>
                        <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                        </ClientSettings>
                        <MasterTableView CommandItemDisplay="Top" PageSize="10">
                            <CommandItemSettings >
                             </CommandItemSettings>
                            <RowIndicatorColumn>
                                <HeaderStyle Width="20px"></HeaderStyle>
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn>
                                <HeaderStyle Width="20px"></HeaderStyle>
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridButtonColumn CommandName="Edit" Text="Edit" UniqueName="EditColumn" ButtonType="ImageButton" ></telerik:GridButtonColumn>
                                <telerik:GridBoundColumn DataField="ID" FilterControlWidth="30px"
                                    HeaderText="Comment ID" UniqueName="ID"></telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="CommentDate" FilterControlWidth="30px"
                                    HeaderText="Comment Date" UniqueName="column2">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Commentor" HeaderText="Commentor"
                                    UniqueName="column3">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Comment" HeaderText="Comment"
                                    UniqueName="column4">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="InsertDate" FilterControlWidth="30px"
                                    HeaderText="Insert Date" UniqueName="column5">
                                </telerik:GridBoundColumn>
                            </Columns>
                            <CommandItemTemplate>
                                <a href="#" onclick="return ShowInsertForm();">Add New Comment</a>
                                <asp:ImageButton ID="excelExport" runat="server" ImageUrl="~/images/ExportToExcel.gif" CommandName="ExportToExcel" ImageAlign="Right" />
                            </CommandItemTemplate>
                            <EditFormSettings EditFormType="Template">
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column" UniqueName="editTemplate"></EditColumn>
                                <FormTemplate>
                                    <table id="Table1" cellspacing="1" cellpadding="1" border="0" class="module">
                                        <tr>
                                            <td colspan="2"><strong>Update Comment:</strong>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                ID:
                                            </td>
                                            <td>
                                                <asp:label ID="ID_TextBox" runat="server" Text='<%# Bind("ID") %>'>
                                                </asp:label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Comment Date:
                                            </td>
                                            <td>
                                                <telerik:RadDatePicker ID="cmDate" Runat="server" DateInput-EmptyMessage="Select a Date" Skin="WebBlue" SelectedDate='<%# Bind("CommentDate") %>' >
                                                </telerik:RadDatePicker>
                                                <asp:RequiredFieldValidator ID="PickerRequiredFieldValidator" runat="server" Display="Dynamic"
                                                ControlToValidate="cmDate" ErrorMessage="Please select a date" ForeColor="Black" Font-Bold="True" Font-Italic="True" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Comment:
                                            </td>
                                            <td>
                                                <asp:RequiredFieldValidator ID="TextBoxRequiredFieldValidator" runat="server" Display="Dynamic"
                                                ControlToValidate="txtComment" ErrorMessage="Must Enter Comment" ForeColor="Black" Font-Bold="True" Font-Italic="True" /><br />
                                                <telerik:RadEditor ID="txtComment" runat="server" Skin="WebBlue" EnableResize="False" Width="600px" Height="250px" Content='<%# Bind("Comment")%>'>
                                                    <CssFiles>
                                                        <telerik:EditorCssFile value="~Style/EditorContentArea.css" />
                                                    </CssFiles>
                                                    <Tools>
                                                        <telerik:EditorToolGroup Tag="MainToolbar">
                                                            <telerik:EditorTool Name="FindAndReplace" />
                                                            <telerik:EditorSeparator />
                                                            <telerik:EditorSplitButton Name="Undo">
                                                            </telerik:EditorSplitButton>
                                                            <telerik:EditorSplitButton Name="Redo">
                                                            </telerik:EditorSplitButton>
                                                            <telerik:EditorSeparator />
                                                            <telerik:EditorTool Name="Cut" />
                                                            <telerik:EditorTool Name="Copy" />
                                                            <telerik:EditorTool Name="Paste" ShortCut="CTRL+V" />
                                                        </telerik:EditorToolGroup>
                                                        <telerik:EditorToolGroup Tag="Formatting">
                                                            <telerik:EditorTool Name="Bold" />
                                                            <telerik:EditorTool Name="Italic" />
                                                            <telerik:EditorTool Name="Underline" />
                                                            <telerik:EditorSeparator />
                                                            <telerik:EditorSplitButton Name="ForeColor">
                                                            </telerik:EditorSplitButton>
                                                            <telerik:EditorSplitButton Name="BackColor">
                                                            </telerik:EditorSplitButton>
                                                            <telerik:EditorSeparator />
                                                            <telerik:EditorDropDown Name="FontName">
                                                            </telerik:EditorDropDown>
                                                            <telerik:EditorDropDown Name="RealFontSize">
                                                            </telerik:EditorDropDown>
                                                        </telerik:EditorToolGroup>
                                                    </Tools>
                                                    <Content>
                                                    </Content>
                                                </telerik:RadEditor>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right" colspan="2">
                                                <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                                    runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' >
                                                </asp:Button
                                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                                CommandName="Cancel"></asp:Button>
                                            </td>
                                        </tr>
                                    </table>
                                </FormTemplate>
                            </EditFormSettings>
                        </MasterTableView>
                    </telerik:RadGrid>


Private Sub RadGrid1_UpdateCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.UpdateCommand
    'Get User's name
    connSql.ConnectionString = sqlConn.ToString()
 
    Dim exSqlUser As New SqlCommand("dbo.getUser", connSql)
    exSqlUser.CommandType = CommandType.StoredProcedure
    exSqlUser.Parameters.AddWithValue("@UID", user)
    exSqlUser.Parameters.Add("@UserName", SqlDbType.VarChar, 40)
    exSqlUser.Parameters("@UserName").Direction = ParameterDirection.Output
 
    connSql.Open()
    exSqlUser.ExecuteNonQuery()
    connSql.Close()
    Dim username As String = exSqlUser.Parameters("@UserName").Value.ToString()
 
    'get Values and compare
    Dim gridediteditem As GridEditFormItem = CType(e.Item, GridEditFormItem)
    Dim newValues As Hashtable = New Hashtable
 
    e.Item.OwnerTableView.ExtractValuesFromItem(newValues, gridediteditem)
 
    'e.Item.OwnerTableView.ExtractValuesFromItem(oldValues, gridediteditem.SavedOldValues)
    Dim Comment As String, CommentDate As DateTime, Updating As String
    Dim oldComment As String = gridediteditem.SavedOldValues("Comment")
    Dim oldDate As DateTime = gridediteditem.SavedOldValues("CommentDate")
 
    Dim ID As Integer
    If newValues.Item("ID") = Nothing Then
        ID = ""
    Else
        ID = CInt(newValues.Item("ID"))
    End If
 
    Dim newCommentDate As DateTime
    If newValues.Item("CommentDate") = Nothing Then
        newCommentDate = ""
    Else
        newCommentDate = newValues.Item("CommentDate").ToString()
    End If
 
    Dim newComment As String
 
    If newValues.Item("Comment") = Nothing Then
        newComment = ""
    Else
        newComment = newValues.Item("Comment").ToString()
    End If
 
    If oldComment <> newComment And newComment <> "" Then
        Updating = "Yes"
        If oldDate <> newCommentDate Then
            Comment = newComment & "<br />Modified by " & username & " on " & Today().ToString() & "<br />" &
                "Date changed from: " & oldDate & " to: " & newCommentDate & " by " & username & " on " & Today().ToString() & "<br /><br />" & oldComment
            CommentDate = newCommentDate
        Else
            Comment = newComment & "<br />Modified by " & username & " on " & Today().ToString() & oldComment
        End If
    Else
        If oldDate <> newCommentDate Then
            Updating = "Yes"
            CommentDate = newCommentDate
            Comment = "<br /> Date changed from: " & oldDate & " to: " & newCommentDate & " by " & username & " on " & Today().ToString() & "<br /><br />" & oldComment
        End If
    End If
 
    If Updating = "Yes" Then
        Dim exSqlCom As New SqlCommand("dbo.EditComment", connSql)
        exSqlCom.CommandType = CommandType.StoredProcedure
        exSqlCom.Parameters.AddWithValue("@ID", ID)
        exSqlCom.Parameters.AddWithValue("@RapID", RadComboBox1.SelectedValue)
        exSqlCom.Parameters.AddWithValue("@User", user)
        exSqlCom.Parameters.AddWithValue("@CommentDate", CommentDate)
        exSqlCom.Parameters.AddWithValue("@Comment", Comment)
        exSqlCom.Parameters.Add("@ReturnValue", SqlDbType.Int)
        exSqlCom.Parameters("@ReturnValue").Direction = ParameterDirection.Output
 
        connSql.Open()
        exSqlCom.ExecuteNonQuery()
        connSql.Close()
    End If
 
End Sub
GP
Top achievements
Rank 1
 answered on 10 Mar 2011
2 answers
125 views
I am having a few select issues with the RadRotator control from the Telerik RadControls.  One problem I am having is it is not displaying in FireFox at all whatsoever  Another issue I am having is that the RadRotator does not display correctly 100% of the time in Internet Explorer, more like 95% of the time.  Another issue that I have is that it doesn't always animate like I intend to, it animates more like 80% of the time.  Below I have included code to show what I have.  Please let me know if there is anything that I am doing wrong.  I have also included a link for you to take a look at.  It is located at http://prgj.thewallstbulls.com.  Thank you!

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ImageRotator.ascx.vb" Inherits="ImageRotator" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<div id="scrollingImages">
    <telerik:RadRotator ID="RadRotator1" runat="server" FrameDuration="4000" SlideShowAnimation-Duration="1000"
                            Width="100%" ItemWidth="100%" Height="400px" PauseOnMouseOver="true" ItemHeight="400px" ScrollDirection="Left">
                    <Items>
                        <telerik:RadRotatorItem ID="item1" runat="server" >
                            <ItemTemplate>                                 
                                <asp:Image ID="Image1" runat="server"  ImageUrl="~/images/managedservices2.jpg" />                                
                            </ItemTemplate>
                         </telerik:RadRotatorItem>
                         <telerik:RadRotatorItem ID="item2" runat="server" >
                            <ItemTemplate>
                                <asp:Image ID="Image2" runat="server"  ImageUrl="~/images/managedservices2.jpg" />
                            </ItemTemplate>
                         </telerik:RadRotatorItem>
                         <telerik:RadRotatorItem ID="item3" runat="server" >
                            <ItemTemplate>
                                <asp:Image ID="Image3" runat="server"  ImageUrl="~/images/managedservices2.jpg" />
                            </ItemTemplate>
                         </telerik:RadRotatorItem>
                    </Items>
                </telerik:RadRotator>
</div>


Marin Bratanov
Telerik team
 answered on 10 Mar 2011
1 answer
80 views
RadRotator does not display in Mozilla Firefox at all no matter what I do.  Please tell me what could be the problem.  I am doing a test so I am using 3 of the same image to get it to work.  It works in Internet Explorer 85% of the time...most of the time the animation starts right up and moves the images over to the left, sometimes the image just stays there as if it is a regular image.  On another note, I try to add code that another thread suggested and it still does not work.  I can even show a link where the page is if need be.  I have the RadRotator in a User Control and below is the code:

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ImageRotator.ascx.vb" Inherits="ImageRotator" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<div id="scrollingImages">
    <telerik:RadRotator ID="RadRotator1" runat="server" FrameDuration="4000" WrapFrames="true"  SlideShowAnimation-Duration="1000"
                            Width="100%" ItemWidth="100%" Height="400px" PauseOnMouseOver="true" ItemHeight="400px" ScrollDirection="Left">
                    <Items>
                        <telerik:RadRotatorItem ID="item1" runat="server" >
                            <ItemTemplate>                                 
                                <asp:Image ID="Image1" runat="server"  ImageUrl="images/managedservices2.jpg" />                                
                            </ItemTemplate>
                         </telerik:RadRotatorItem>
                         <telerik:RadRotatorItem ID="item2" runat="server" >
                            <ItemTemplate>
                                <asp:Image ID="Image2" runat="server"  ImageUrl="images/managedservices2.jpg" />
                            </ItemTemplate>
                         </telerik:RadRotatorItem>
                         <telerik:RadRotatorItem ID="item3" runat="server" >
                            <ItemTemplate>
                                <asp:Image ID="Image3" runat="server"  ImageUrl="images/managedservices2.jpg" />
                            </ItemTemplate>
                         </telerik:RadRotatorItem>
                    </Items>
                </telerik:RadRotator>
</div>
Marin Bratanov
Telerik team
 answered on 10 Mar 2011
5 answers
87 views
Hi,

I have an application that I created using the Telerik Editor 2008 Q1. Recently I upgraded to Telerik 2008 Q3 SP2 and now the Default2006 skin is no longer working. Other skins work, was this skin removed?

Thank you for your help.
Georgi Tunev
Telerik team
 answered on 10 Mar 2011
1 answer
90 views
Hello,

I am new to ASP.Net Ajax and Telerik component.
I made a page that use Telerik Ajax Manager, Ajax Panel that contains a form for user to enter user name and password for login.

When user click submit, the Ajax Panel will do a postback, and only reload the Ajax Panel's content to check if is correct user name and password.

The problem is, there should be an exception throw during the checking user name and password process during the postback. (Because for some reason, the data table missing a field and it throw exception).
When I do that in internet explorer, the page just post back normally (with the form that let user enter user name and password) and not login.
But when I do it in Visual Studio, the exception will throw in during the postback.

So is there a way I can handle if there is any exception throw during Ajax postback on any page globally and redirect to an error page?
Or display error on the page?
I tried to use try catch then Response.Write to print out the error but it doesn't work well....

Any example would be a great help.

Thanks in advance.
Maria Ilieva
Telerik team
 answered on 10 Mar 2011
4 answers
126 views
Hello, I must have been living under a rock and did not know about such an awesome creation.
I looked everywhere. Is this still available for SharePoint 2007?
I have read from older posts on the web that it is free.
Please forgive if I am mistaken.

Thank you in advance.
Emilia
Telerik team
 answered on 10 Mar 2011
5 answers
175 views
How can I get the word count at the server side?

If there is no way of getting it at the server side then how can I do it at the client side ?

thanks,
yaniv
Rumen
Telerik team
 answered on 10 Mar 2011
1 answer
309 views
Hello,
My main issue is when I have inside RadWindowManager --> RadWindow --> ContentTemplate an RadAjaxPanel...
When I use it the first time, the page is posting back... I don't want to have the PostBack..
The second time and up, I don't have post back and the LoadingPanel is showing.
I  have had to add a code on the Search Button (inside the ajax panel) to show window on load, since my window is a search box that will search inside content..


I will show you my main template of the page:
The rad Window:
<telerik:RadWindowManager ID="rWinManager" runat="server">
    <Windows>
        <telerik:RadWindow ID="rWinResult" runat="server" OnClientActivate="WindowOnClientActivate" Width="350" Behaviors="Close">
            <ContentTemplate>
                <!--This is the main content that needs to work only with ajax.-->
            </ContentTemplate>
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>


My update panel that works fine outside the RadWindow:
<asp:UpdatePanel ID="MyUpdatePanel" runat="server" UpdateMode="Always">
    <ContentTemplate>
        <!--poting in a table will make the controls aligned.. it was not.-->
        <table>
        <tr>
            <td><telerik:RadTextBox ID="TxtSearch" runat="server" Width="200"></telerik:RadTextBox></td>
            <td>
                <telerik:RadButton ID="BtnSearch" runat="server" OnClick="BtnSearch_Click">
                    <Icon PrimaryIconCssClass="rbSearch" />
                </telerik:RadButton>
            </td>
            <td>
                <asp:UpdateProgress ID="MyUpdateProgress" runat="server" AssociatedUpdatePanelID="MyUpdatePanel">
                    <ProgressTemplate>
                        <span style="color:Gray;font-size:10px;">
                            Loading...
                        </span>
                    </ProgressTemplate>
                </asp:UpdateProgress>
            </td>
        </tr>
        </table>
        <telerik:RadTreeView ID="rtvResult" runat="server" DataFieldID="Key" DataValueField="Key" DataTextField="DisplayValue"></telerik:RadTreeView>
    </ContentTemplate>
</asp:UpdatePanel>

Now when I place the UpdatePanel (the second code snip), inside the Window manager, I am getting error.
Cannot unregister UpdatePanel with ID 'MyUpdatePanel' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
Parameter name: updatePanel

I hope I was clear with my question... Let me know if you need more code or if you have more questions.

Thank you for your help.
Isaac
Emerald One
Svetlina Anati
Telerik team
 answered on 10 Mar 2011
3 answers
89 views
I want to change RadDialogOpener's ViewPaths(Or UploadPaths) property by client javascript code, how can i do? When i user ajax code change the ViewPaths value, but it can't work?

public static void ShowDocumentDialog(RadDialogOpener rdo, string sFolders, string sExts, string sClientCallbackFunction, int iMaxUploadFileSize)
{
    string[] aFolder = sFolders.Split(',');
 
    FileManagerDialogParameters documentManagerParameters = new FileManagerDialogParameters();
    documentManagerParameters.ViewPaths = aFolder;
    documentManagerParameters.UploadPaths = aFolder;
    documentManagerParameters.DeletePaths = aFolder;
    documentManagerParameters.MaxUploadFileSize = iMaxUploadFileSize;
 
    if (!string.IsNullOrEmpty(sExts))
        documentManagerParameters.SearchPatterns = sExts.Split(',');  //{ "*.doc", "*.docx", "*.pdf", "*.xls", "*.xlsx", "*.ppt", "*.pptx", "*.zip", "*.rar", "*.txt" };
 
    DialogDefinition documentManager = new DialogDefinition(typeof(DocumentManagerDialog), documentManagerParameters);
    documentManager.ClientCallbackFunction = sClientCallbackFunction;
    documentManager.Width = Unit.Pixel(694);
    documentManager.Height = Unit.Pixel(440);
 
    // Remove it if exist
    if (rdo.DialogDefinitions.ContainsKey("DocumentManager"))
        rdo.DialogDefinitions.Remove("DocumentManager");
 
    rdo.DialogDefinitions.Add("DocumentManager", documentManager);
}


thanks
Rumen
Telerik team
 answered on 10 Mar 2011
1 answer
51 views
I have a textbox within a repeater...
<rad:RadNumericTextBox ID="radNumQty" runat="server" CssClass="txtbox" Width="40px" IncrementSettings-Step="1" MinValue="1" MaxValue="9999999" MaxLength="7" NumberFormat-DecimalDigits="0" ClientEvents-OnValueChanging="clientUpsellChanges">
</rad:RadNumericTextBox>

In my clientUpsellChanges function, I change its' class if there is an error.
if (intQtyError != 0) {
// Toggle css on field with error
var radQtyBox = $find(arrExtraItemFields[0]);
radQtyBox.TextBoxElement.className = "txtboxerror";
}

This all works fine, but I'm finding that the error class gets removed as soon as you mouseover the box. Why is this? How do I prevent it?
Tsvetina
Telerik team
 answered on 10 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?