Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
128 views
Hello,

We have a particular situation in which I need to generate a response entirely server-side via Response.Write. We are using Telerik's embedded copy of jQuery and in this particular response, I need to include the jquery script. Doing a bit of investigation, I came up with this:

Response.Write("<script type='text/javascript' src='" + Request.ApplicationPath + "/Telerik.Web.UI.WebResource.axd?compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d1.0.61025.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a1f0f78f9-0731-4ae9-b308-56936732ccb8%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-US%3ad89f6e67-3ab0-4fcf-b5f1-b51b735ae3d9%3a16e4e7cd%3af7645509%3a24ee1bba%3a1e771326%3aaa288e2d'></script>");

Not pretty and seems a bit unreliable. I tried to instantiate a RadScriptManager control server-side, add the core scripts programmatically and then call RenderControl on the manager object, but couldn't get around an exception thrown stating that the control must be inside of a <form runat="server">.

Is there a better way of doing this? Cleaner and standardized? What are the parameters for the Telerik.Web.UI.WebResource.axd?

Thanks,

Mike Oliver
Infotrieve, Inc.
Mike
Top achievements
Rank 1
 answered on 12 Oct 2010
1 answer
125 views
What would be the correct CSS code to use to have the text color of the main root menu change when the menu is moused over and while hovering over the sub-items?

Right now I'm using this to set the color to white:

.RadMenu a.rmLink
{
    cursor: default;
    display: block;
    text-decoration: none;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #ffffff;
    
}

and I want the color to change to black (#000000) while that menu is open. Thanks!
Adam sharpe
Top achievements
Rank 1
 answered on 12 Oct 2010
3 answers
47 views

CommandItemSettings

 

 

ExportToPdfText="Export to Pdf"

 



Whenever I use the designer it keeps putting that in..

Furthermore.. Id actually like that functionality
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="EntityDataSource1" AutoGenerateEditColumn="True"
           Width="500px" OnUpdateCommand="RadGrid1_UpdateCommand" OnInsertCommand="RadGrid1_InsertCommand"
           AutoGenerateColumns="False" AllowFilteringByColumn="True" AllowPaging="True"
           AllowSorting="True" GridLines="None" ShowGroupPanel="True">
           <ClientSettings AllowDragToGroup="True">
           </ClientSettings>
           <MasterTableView DataSourceID="EntityDataSource1" DataKeyNames="OrgID" CommandItemDisplay="Top">
               <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
               <Columns>
                   <telerik:GridBoundColumn DataField="OrgID" HeaderText="OrgID" ReadOnly="True" SortExpression="OrgID"
                       UniqueName="OrgID" DataType="System.Int32" Visible="false">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="OrgName" HeaderText="OrgName" SortExpression="OrgName"
                       UniqueName="OrgName">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="Address" HeaderText="Address" SortExpression="Address"
                       UniqueName="Address" Visible="false">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="City" HeaderText="City" SortExpression="City"
                       UniqueName="City">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="State" HeaderText="State" SortExpression="State"
                       UniqueName="State">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="Zip" HeaderText="Zip" SortExpression="Zip" UniqueName="Zip"
                       Visible="false">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="Phone" HeaderText="Phone" SortExpression="Phone"
                       UniqueName="Phone" Visible="false">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="Fax" HeaderText="Fax" SortExpression="Fax" UniqueName="Fax"
                       Visible="false">
                   </telerik:GridBoundColumn>
               </Columns>
           </MasterTableView>
       </telerik:RadGrid>
       <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=G3TEntities"
           DefaultContainerName="G3TEntities" EnableFlattening="False" EnableInsert="True"
           EntitySetName="Orgs" EnableUpdate="True">
       </asp:EntityDataSource>
but I don't see any 'Export to PDF' on my radgrid.. what else do I need to add?
Daniel
Telerik team
 answered on 12 Oct 2010
3 answers
140 views

Hi,

I'm currently using the RadEditor to update html content added into a Gridview. I modified the sample code but it doesn't work the same? How it works is the person can add their content, visually with all the styles of bold, red text, etc. Then submit that to the database. If they want to edit that html page, they just go to the Gridview, click edit, and the content from the grid will populate the editor where they can edit it, again visually, and then resubmit overwriting the content that's there. My problem is I can submit to the database but I can't pull it back out meaning edit doesn't work nor does delete? Here's the code:

Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports Telerik.Web.UI
Imports System.Data.SqlClient
Imports System.IO

Partial Class _Default
    Inherits System.Web.UI.Page

 

    ' Important!!! The method is called AFTER Page_Load method is executed, so make sure you do not
    ' inadvertently overwrite the editor content there before you process it here!
    Public Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSubmit.Click

        Dim connection As SqlConnection = CreateConnection()
        Dim command As SqlCommand = Nothing

        If EditedNews.Value <> String.Empty Then
            command = New SqlCommand("UPDATE ElectPageEditor SET NewsDate = GETDATE(), NewsText = @NewsText WHERE NewsID = @NewsID", connection)
            command.Parameters.AddWithValue("@NewsText", NewsEditor.Content)
            command.Parameters.AddWithValue("@NewsID", Convert.ToInt32(EditedNews.Value))
        Else
            command = New SqlCommand("INSERT INTO ElectPageEditor (NewsDate, NewsText) VALUES (GETDATE(), @NewsText)", connection)
            command.Parameters.AddWithValue("@NewsText", NewsEditor.Content)
        End If
        Try
            connection.Open()
            command.ExecuteNonQuery()
        Catch ex As Exception
            lblError.Text = "Error in submit form for " & ex.Message
        Finally
            connection.Close()
        End Try

        Me.Response.Redirect(Me.Request.Url.PathAndQuery)
    End Sub

    Private Function CreateConnection() As SqlConnection
        Dim _connectionString As String = ConfigurationManager.ConnectionStrings("VRASConnectionString").ConnectionString
        Return New SqlConnection(_connectionString)
    End Function

    Protected Sub ReadAllRecords()
        Dim connection As SqlConnection = CreateConnection()
        Try
            connection.Open()
            Dim command2 As New SqlCommand("SELECT NewsID, NewsDate, NewsText FROM ElectPageEditor", connection)
            NewsGrid.DataSource = command2.ExecuteReader()
            NewsGrid.DataBind()
        Catch ex As Exception
            lblError.Text = "Error in application " & ex.Message
        Finally
            connection.Close()
        End Try
    End Sub

    Protected Sub NewsGrid_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles NewsGrid.RowCommand
        Dim connection As SqlConnection = CreateConnection()
        Dim row As GridViewRow = TryCast(NewsGrid.Rows(e.CommandArgument), GridViewRow)
        NewsGrid.DataKeys(row.RowIndex).Value.ToString()
        If e.CommandName = "Delete" Then
            Dim com As New SqlCommand("DELETE FROM ElectPageEditor WHERE NewsID = @NewsID", connection)

            com.Parameters.AddWithValue("@NewsID", row.Cells(0).Text)
            Try
                connection.Open()
                com.ExecuteNonQuery()
            Catch ex As Exception
                lblError.Text = "Error running command. " & ex.Message
            Finally
                connection.Close()
            End Try
        ElseIf e.CommandName = "Edit" Then
            Dim command As New SqlCommand("SELECT NewsText FROM ElectPageEditor WHERE NewsID = @NewsID", connection)
            command.Parameters.AddWithValue("@NewsID", row.Cells(0).Text)

            Try
                connection.Open()
                Dim record As SqlDataReader = command.ExecuteReader(CommandBehavior.CloseConnection)
                If record.Read() Then
                    NewsEditor.Content = record.GetString(0)
                    EditedNews.Value = row.Cells(0).Text
                Else
                    NewsEditor.Content = ""
                    EditedNews.Value = ""
                End If

                ' Will close the connection as well
                record.Close()
            Catch ex As Exception
                lblError.Text = "Error modifying information. " & ex.Message
            Finally
                connection.Close()

            End Try
        End If
        ' Add code to delete row from data source.
        ReadAllRecords()
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            ReadAllRecords()
        End If

    End Sub
End Class

Paul Rickard
Top achievements
Rank 1
 answered on 12 Oct 2010
2 answers
66 views
Hi there,

Im using the RadChart Control with the line Type but i have a problem i need that  LineSeriesAppearance-PenStyle be diferent for all series and not to repeat the style , what i tried to say :

Serie 1 : Dotted
Serie 2: Dash
Serie 3 DashDot
Serie 4.....

Minimun i need 6 diferents styles;please  how can i configure the custom property or another property like this to do it  ?

Regards
Carlos.
Carlos
Top achievements
Rank 1
 answered on 12 Oct 2010
1 answer
69 views
I'm working my through the AdvancedTemplate example in the docs (which is quite out of date, BTW) and have tried to add the Description and Reminder fields to the Template.

Adding the Description has worked OK, but I can't make Reminder work. If I add a line like this to my template ...
Reminder='<%# Bind("Reminder") %>'

and run the page it displays OK and double-clicking to open the advanced form works. But if I try and save the appointment I get this JS error.

Sys.WebForms.PageRequestManagerServerErrorException: Item has already been added. Key in dictionary: 'Reminder'  Key being added: 'Reminder'

-- 
Stuart
Veronica
Telerik team
 answered on 12 Oct 2010
4 answers
128 views
I have followed the example on how to change the End Date when the Start Date changes and it works great.

However, when the Start Time is changed, I would like to achieve the following:

  • I need the End Time to change, but I'd like it to change by a pre-defined amount of time (e.g. 1 hour 30 mins, from a TimeSpan in the code behind) added on to the Start Time. How can I do this?

Regards,
Anthony
Veronica
Telerik team
 answered on 12 Oct 2010
10 answers
263 views
I would like to add some text to the progress area in the colored box above the progress bars. Is this possible and if so how can I achieve this?
ATS
Top achievements
Rank 1
 answered on 12 Oct 2010
1 answer
104 views
I've got a multi-column radComboBox that is working great except for 1 issue: 

The web app uses forms authentication...and when the cookie authentication ticket expires and the user types something into the radcombobox nothing happens...no error is returned/displayed and the web page is not redirected to the login.aspx page (which is what normally happens). 

A couple other things to note:
  1. I've enabled EnableLoadOnDemand implementing OnItemsRequested at the page level.  When the user types into the radComboBox after the Auth Ticket has expired, I confirmed that Fiddler shows login.aspx being returned as the result...but radComboBox just shows "Loading..." and nothing happens.
  2. I'm using latest version - Q2 2010

My Question:

How do i catch this scenario and is there a recommended best practice on how to handle it?  Preferably I would like to just have the radComboBox redirect to the Login.aspx page versus eating the page and just showing "Loading....".  Currently as it is, the user has to force a postback to get the page to redirect to login.aspx. 

Any suggestions much appreciated.  Sample code below:

<telerik:RadComboBox ID="RadComboBox1" runat="server" MarkFirstMatch="True" HighlightTemplatedItems="true"
                            EnableLoadOnDemand="true" ShowMoreResultsBox="true" Width="200px" Skin="Default"
                            DropDownWidth="350px" OnItemsRequested="RadComboBox1_ItemsRequested" DataTextField="FullName"
                            DataValueField="DirID" OnClientItemsRequestFailed="OnClientItemsRequestFailedHandler">
                            <HeaderTemplate>
                                <ul>
                                    <li class="col1">File ID</li>
                                    <li class="col2">Client Name</li>
                                    <li class="col3">Birth Date</li>
                                </ul>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <ul>
                                    <li class="col1">
                                        <%# DataBinder.Eval(Container.DataItem, "DirID") %></li>
                                    <li class="col2">
                                        <%# DataBinder.Eval(Container.DataItem, "FullName") %></li>
                                    <li class="col3">
                                        <%# DataBinder.Eval(Container.DataItem, "Birthdate", "{0:d}") %></li>
                                </ul>
                            </ItemTemplate>
                        </telerik:RadComboBox>
Simon
Telerik team
 answered on 12 Oct 2010
4 answers
254 views
I have a basic grid that I want to allow InPlace editing of a few columns (I will later add an Edit Form to allow for full editing but, for now, this is it).  One of the columns of the grid I want to be a GridDropDownColumn and default it to display the current data and switch to a dropdownlist in Edit mode (again, using InPlace editing) and I want the default selected value to be the current value.

I've been through every demo and sample I could find in Telerik's document but I cannot get the GridDropDownColumn to do ANYTHING. No data shows up for it and no dropdown ever shows when I click the down arrow.  I finally at least got some data to display by falling back to a GridTemplateColumn and putting in an asp:DropDownList control in the EditItemTemplate.  Here is the ASPX:

<asp:ObjectDataSource ID="odsGetTaskStartTimes" runat="server" TypeName="DMCproWebApp.BALHelper" SelectMethod="GetTaskStartTimes" />
<asp:ObjectDataSource id="odsGetProgramServicesFast" runat="server" TypeName="DMCproWebApp.BALHelper" SelectMethod="GetProgramServicesFast">
    <SelectParameters>
        <asp:ControlParameter Name="ProgramNumber" ControlID="hiddenProgramListValue" PropertyName="Value" DbType="String" />
    </SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="odsGetProgramServiceTypes" runat="server" TypeName="DMCproWebApp.BALHelper" SelectMethod="GetProgramServiceTypes" />
   
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="radgrdProgramServicesFast">
            <UpdatedControls><telerik:AjaxUpdatedControl ControlID="radgrdProgramServicesFast" LoadingPanelID="RadAjaxLoadingPanel1"/></UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<div class="GridViewContainer" style="width:944px;">
    <telerik:RadGrid ID="radgrdProgramServicesFast" runat="server" Width="942px" DataSourceID="odsGetProgramServicesFast" EnableLinqExpressions="true"
        EnableEmbeddedSkins="false" Skin="DMCpro" ShowStatusBar="true"
        AutoGenerateColumns="false" AllowFilteringByColumn="false" AllowPaging="false" AllowSorting="true">
        <ClientSettings EnableRowHoverStyle="true" Selecting-AllowRowSelect="true" Scrolling-AllowScroll="true" Scrolling-ScrollHeight="280px" />
        <GroupingSettings CaseSensitive="false" />
        <MasterTableView TableLayout="Fixed" DataKeyNames="ProgramNumber,fldVenue,LineNumber,ItemNumber,OfficeLocation,ProgramLocation,ProgramStartDate,fldStatus,fldTruckLoadIn,AddToSchedule,fldAddtoContract,CustomerID,Description,RFPCount" EditMode="InPlace">
            <ItemStyle Font-Size="Small" Wrap="false" />
            <AlternatingItemStyle Font-Size="Small" Wrap="false" />
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderStyle-CssClass="radGridViewHeader" HeaderStyle-Width="46px" EditImageUrl="~/img/Edit16x16.png" UpdateImageUrl="../img/Save16x16.png" CancelImageUrl="../img/Cancel16x16.png" />
                <telerik:GridImageColumn UniqueName="RFP" ImageUrl="~/img/Check-16x16.png" HeaderText="RFP" HeaderStyle-CssClass="radGridViewHeader" HeaderStyle-Width="22px"
                    HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" />
                <telerik:GridBoundColumn DataField="fldTruckLoadIn" HeaderText="Sort" SortExpression="fldTruckLoadIn" HeaderStyle-CssClass="radGridViewHeader" HeaderStyle-Width="35px" HeaderStyle-HorizontalAlign="Left" AllowFiltering="false" />
                <telerik:GridCheckBoxColumn DataField="AddToSchedule" HeaderText="QS" SortExpression="AddToSchedule" HeaderStyle-CssClass="radGridViewHeader" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="Left" AllowFiltering="false" />
                <telerik:GridCheckBoxColumn DataField="fldAddToContract" HeaderText="Add" SortExpression="fldAddToContract" HeaderStyle-CssClass="radGridViewHeader" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="Left" AllowFiltering="false" />
                <telerik:GridBoundColumn DataField="Description" HeaderText="Title" SortExpression="Description" HeaderStyle-CssClass="radGridViewHeader" HeaderStyle-Width="135px" HeaderStyle-HorizontalAlign="Left" AllowFiltering="false" />
                <telerik:GridTemplateColumn HeaderText="Service" UniqueName="ServiceType" HeaderStyle-CssClass="radGridViewHeader" HeaderStyle-Width="175px" HeaderStyle-HorizontalAlign="Left" AllowFiltering="false">
                    <ItemTemplate>
                        <%#DataBinder.Eval(Container.DataItem, "ServiceType")%>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlProgramServiceTypes" runat="server" Width="175px"
                            DataSourceID="odsGetProgramServiceTypes" DataTextField="fldService" DataValueField="fldServiceID" /> 
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridDropDownColumn DataField="ServiceType" DataSourceID="odsGetProgramServiceType"
                    HeaderText="Service 2" ListTextField="fldservice" ListValueField="fldServiceID"
                    UniqueName="Service2" HeaderStyle-CssClass="radGridViewHeader" HeaderStyle-Width="175px" >
                </telerik:GridDropDownColumn>  
                <telerik:GridBoundColumn DataField="StartDate" HeaderText="Start Date" SortExpression="StartDate" DataFormatString="{0:MM/dd/yyyy}" HeaderStyle-CssClass="radGridViewHeader" HeaderStyle-Width="75px" HeaderStyle-HorizontalAlign="Left" AllowFiltering="false" ReadOnly="true" />
                <telerik:GridBoundColumn DataField="EndTime" HeaderText="Ends" SortExpression="EndTime" DataFormatString="{0:MM/dd/yyyy}" HeaderStyle-CssClass="radGridViewHeader" HeaderStyle-Width="75px" HeaderStyle-HorizontalAlign="Left" AllowFiltering="false" ReadOnly="true" />
                <telerik:GridBoundColumn DataField="LineTotal" HeaderText="Service Total" SortExpression="LineTotal" UniqueName="LineTotal" DataFormatString="{0:c}" HeaderStyle-CssClass="radGridViewHeader" HeaderStyle-Width="90px" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Right" ReadOnly="true" />
                <telerik:GridBoundColumn DataField="fldServiceVenue" HeaderText="Costing Sheet" SortExpression="fldServiceVenue" UniqueName="fldServiceVenue" HeaderStyle-CssClass="radGridViewHeader" HeaderStyle-Width="175px" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" ReadOnly="true" />
                <telerik:GridBoundColumn DataField="Cost" Visible="false" ReadOnly="true" />
                <telerik:GridBoundColumn DataField="fldVenue" Visible="false" ReadOnly="true" />
                <telerik:GridBoundColumn DataField="LineNumber" Visible="false" ReadOnly="true" />
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
</div>


Codebehind:
Private Sub radgrdProgramServicesFast_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles radgrdProgramServicesFast.ItemDataBound
    If (TypeOf e.Item Is GridDataItem) Then
        Dim gdi As GridDataItem = DirectCast(e.Item, GridDataItem)
        Dim LineTotal As String = Replace(gdi.Item("LineTotal").Text, " ", "0")
        Dim Cost As String = Replace(gdi.Item("Cost").Text, " ", "0")
        Dim chkQS As CheckBox = DirectCast(gdi.Item("AddToSchedule").Controls(0), CheckBox)
        Dim chkAdd As CheckBox = DirectCast(gdi.Item("fldAddToContract").Controls(0), CheckBox)
        m_Proposed += CDec(IIf(LineTotal = String.Empty, 0, LineTotal)) + CDec(IIf(Cost = String.Empty, 0, Cost))
        m_QS += CDec(IIf(chkQS.Checked, LineTotal, 0))
        m_Total += CDec(IIf(chkAdd.Checked, LineTotal, 0))
        Dim RFPCount As Integer = CInt(radgrdProgramServicesFast.MasterTableView.DataKeyValues(e.Item.ItemIndex)("RFPCount"))
        If (RFPCount = 0) Then
            Dim img As Image = DirectCast(gdi.Item("RFP").Controls(0), Image)
            img.Visible = False
        End If
        Dim cp As ContentPlaceHolder = Page.Form.FindControl("MasterContentPlaceHolder")
        Dim status As Integer = DirectCast(cp.FindControl("ddlProgramStatus"), DropDownList).SelectedValue
        If (gdi.EditFormItem IsNot Nothing) Then
            If (status <> 22) Then
                gdi.Item("btnEditService").Visible = True
            ElseIf (status = 22) And Roles.IsUserInRole(Permissions.Programs_Change_Sold_Invoiced) Then
                gdi.Item("btnEditService").Visible = True
            Else
                gdi.Item("btnEditService").Visible = False
            End If
        End If
    End If
End Sub
Jerry T.
Top achievements
Rank 1
 answered on 12 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?