Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
186 views
I have a page with 2 RadEditor controls on it and I am having problems formatting the text to save into a SQL DB. Here is my code:

Protected

Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click  

 

Dim Title, Abstract, Comments As String  

 

Dim Display As Integer  

 

Dim NewsDate As Date

 

Title =

Me.rtxtTitle.Text

 

 

 Abstract =

Me.redAbstract.Text

 

 

 

Dim strAbstract = Abstract.Substring(0, Abstract.Length - 1)

 

 

 Comments =

Me.redComments.Text

 

 

 

Dim strComments = Comments.Substring(0, Comments.Length - 1)

 

 

 NewsDate =

Me.rdtpNews.DbSelectedDate

 

 

 

If Me.chkDisplayYN.Checked = True Then

 

 

 

Display = 1

 

 

Else

 

 

 

Display = 0 

 

 

End If  

 

'Populate the datatable  

 

Dim sConnString As String = ConfigurationManager.ConnectionStrings("PU89").ConnectionString  

 

Dim objConnection As New SqlClient.SqlConnection(sConnString)  

 

Dim strSQL As String = "INSERT INTO tblNews (Title,Display,BDate,Abstract,Comments)" & _  

 

" VALUES ('" & Title & "', '" & Display & "', '" & NewsDate & "', '" & strAbstract & "', '" & strComments & "');"  

 

Dim dbComm As New SqlClient.SqlCommand(strSQL, objConnection)  

 

Dim iID As Integer  

 

Try 

 

objConnection.Open()

iID = dbComm.ExecuteScalar()

 

Catch ex As Exception  

 

 

Response.Write(ex.Message)

Response.End() 

 

 

Finally  

 

If objConnection.State = ConnectionState.Open Then 

 

objConnection.Close() 

End If  

 

End Try  

 

End Sub

This method works for short blocks of text with no special characters. When I try to enter the complete text (copied from a webpage and pasted into the RadEditor) I get syntax errors:

"Incorrect syntax near 's'. Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon."

Thanks,
Shelley

 

 

Rumen
Telerik team
 answered on 11 Nov 2008
1 answer
210 views
I'm trying to do access the DataKeyField's value for whatever appointment was cilcked from the 

 

OnAppointmentClick event so that I can redirect to a different page with the DataKeyField's value sent along with it, which will be used to pull and display detailed data from the database.  I've searched the forums and can't seem to find out how this is done.  The scheduler is a read-only scheduler so using events that fire on modified appointments will not work.

The code is here:

<telerik:RadScheduler ID="ChangeCalendar" runat="server" DataKeyField="ChangeControlID"   
                    DataSubjectField="ChangeControlNumber" DataStartField="TargetStartDate" 
                    DataEndField="TargetEndDate" AllowDelete="False" OverflowBehavior="Expand"
                     OnAppointmentClick="ChangeCalendar_OnAppointmentClick"  
                        ReadOnly="True" SelectedView="MonthView">  
              
            </telerik:RadScheduler> 


I know this has to be easy... but I cannot seem to find anything about how to do this.

Thanks.

Marty
Top achievements
Rank 1
 answered on 11 Nov 2008
2 answers
166 views
I'm working with RadGrid and I would like to use it for viewing purposes only. I've set EnableViewState to false, but it still generates about 5K of viewstate data. How can I completely disable the viewstate or at least make it less than 1K?

Thanks.
Peter Zolja
Top achievements
Rank 1
 answered on 11 Nov 2008
1 answer
127 views
I know I am missing something painfully obvious here, but...

I have a Toolbar that I am using almost entirely with CodeBehind. It is built and programatically handled in C#.

I have a RadWindowManager with a couple of windows that I need to open by clicking on toolbar buttons. Is there an example of how to do this? I am getting into some really kludge javascript to prevent postbacks, show the window, etc...

Thanks,

Jim
Georgi Tunev
Telerik team
 answered on 11 Nov 2008
3 answers
140 views
Hello

I load nodes on-demand using a webservice into a radtreeview where some nodes should not be checkable. The RadTreeNodeData class does not have a Checkable property but I am using my own specilaized class where I have a "Checkable" member:

[Serializable]
  public class TreeNodeData
  {
    public string Text;
    public string Value;
    public int ExpandMode; //Telerik.Web.UI.TreeNodeExpandMode
    public bool Checkable;
  }

This does not work, all nodes are always checkable. Is there a way to on-demand load nodes that are not checkable?

regards

Tomas Särnhammar
Tomas
Top achievements
Rank 1
 answered on 11 Nov 2008
4 answers
162 views
I have managed to override the style properties of the grid but am having trouble figuring out where i would set the CssClass for items that are being dragged.  What I am after is the dashed line indicating where the item will be dropped if you let go of the mouse button.  Is there something like "ItemStyle-CssClass" for the Drop Indicator? 
Dave Myers
Top achievements
Rank 1
 answered on 11 Nov 2008
17 answers
182 views
Hello,

I use RadGrid with paging enabled. When there is only one page in the grid (items count < page size), pager is hidden, but after postback it becomes visible.

Please check my code.

Best regards, Oleg.

Windows XP SP2
RadGrid For ASP.NET AJAX 2008.1.619.35
Visual Studio 2008
.NET 3.5


Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ 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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <asp:Button ID="Button1" runat="server" Text="Button" />
    <telerik:RadGrid ID="gridAccounts" runat="server" PageSize="20" AllowPaging="True"
        DataSourceID="ObjectDataSource1">
        <MasterTableView AutoGenerateColumns="false">
            <Columns>
                <telerik:GridBoundColumn DataField="Name" HeaderText="Name">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Amount" HeaderText="Amount">
                </telerik:GridBoundColumn>
            </Columns>
            <PagerStyle Visible="true" Mode="NextPrevNumericAndAdvanced" />
        </MasterTableView>
    </telerik:RadGrid>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData"
        EnablePaging="true" SelectCountMethod="SelectCount" StartRowIndexParameterName="offset"
        MaximumRowsParameterName="count" TypeName="Class1">
        <SelectParameters>
            <asp:ControlParameter Name="searchContext" ControlID="ObjectDataSource1" PropertyName="NamingContainer.Page.SearchContext" />
        </SelectParameters>
    </asp:ObjectDataSource>
    </form>
</body>
</html>


Default.aspx.cs

using System;

public partial class _Default : System.Web.UI.Page
{
  public SearchContext SearchContext
  {
    get
    {
      return new SearchContext() { MinAmount = 10 };
    }
  }
}


Class1.cs

using System;
using System.Collections.Generic;

public class Class1
{
  public Transaction[] GetData(SearchContext searchContext, int offset, int count)
  {
    List<Transaction> transactions = new List<Transaction>();

    for (int i = 0; i < 3; ++i)
      transactions.Add(new Transaction() { Name = "T" + i, Amount = i });

    return transactions.ToArray();
  }

  public int SelectCount(SearchContext searchContext)
  {
    return 3;
  }
}

public class Transaction
{
  public string Name { get; set; }
  public int Amount { get; set; }
}

[Serializable]
public class SearchContext
{
  public int MinAmount { get; set; }
}
Jason
Top achievements
Rank 1
 answered on 11 Nov 2008
6 answers
101 views
I need to show a blocked time in the scheduler so I handle the TimeSlotCreated event and execute logic that determines the state of the timeslot.  If it's in a non-schedulable time range then I set e.TimeSlot.CSS = "blockedStyle".

This works fine except when I navigate backwards in time.  For example, I click the back 1 day button or I select a previous date in the popup calendar.

I notice that my event handler executes but when the calendar re-renders the blocked style disappears.  However if I cause it to postback using any other buttons, for example the "Today" button, a custom link or the Show All 24 hours button it correctly renders the blocked style again.

Is there a work around or patch for this?

Thanks,
Al
Peter
Telerik team
 answered on 11 Nov 2008
2 answers
140 views
I have a regular gridview that has a link that opens a rad window.  The rad window is defined as this:
<telerik:RadWindowManager ID="radWindows" runat="server" Left="" Modal="True" 
         Top="" VisibleStatusbar="false" VisibleTitlebar="True" Behaviors="Close"
        <Windows> 
            <telerik:RadWindow 
                ID="radEditPullDetail" 
                runat="server"  
                Height="568px" 
                Width="824px"                 
                Title="Details" 
                ClientCallBackFunction="CallBackFunction"  
                Behaviors="Maximize,Close"                 
                > 
            </telerik:RadWindow>             
        </Windows> 
        </telerik:RadWindowManager> 
On the rowdatabound event of the gridview, I assign the onclick method of a hyperlink control to this:
"window.radopen('newpage.aspx','radEditPullDetail'); return false;" 
Everything works good there.  Recently I added the Maximize behavior with the Close behavior.  When I open the rad window, maximize it, then click the "red X" to close, then reopen another rad window, the width is set to 100% and the height is what it should be.  Not the desired effect.  Furthermore, if you re maximize the window, it maximizes but then falls into (behind) the grayed out are of the page and you cannot click anything.  Any ideas?
Dennis
Top achievements
Rank 1
 answered on 11 Nov 2008
1 answer
72 views
Hello,

I want to simulate a click in my multi column combo when ma page is loaded.

Someone have an idea?

thank you
Yana
Telerik team
 answered on 11 Nov 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?