Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
111 views
I want to drag and drop from a RadListBox To another RadListBox in a table ?

and persist this server side but it not works :

My .cs :

protected void Page_Load(object sender, EventArgs e)
        {
            // Total number of rows.
            int rowCnt = 4;
            // Current row count.
            int rowCtr;
            // Total number of cells per row (columns).
            int cellCtr;
            // Current cell counter
            int cellCnt = 7;

           // rowCnt = int.Parse(TextBox1.Text);
           // cellCnt = int.Parse(TextBox2.Text);

            for (rowCtr = 1; rowCtr <= rowCnt; rowCtr++)
            {
                // Create new row and add it to the table.

                HtmlTableRow tRow = new HtmlTableRow();
                Table1.Rows.Add(tRow);
                for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++)
                {
                    // Create a new cell and add it to the row.
                    HtmlTableCell tCell = new HtmlTableCell();
                   // tCell.Text = "Row " + rowCtr + ", Cell " + cellCtr;
                    RadListBox rr = new RadListBox();
                    rr.ItemTemplate = new RadListBoxTemplate();
                    rr.SelectionMode = ListBoxSelectionMode.Multiple;
                    rr.AllowReorder =true;
                    rr.AutoPostBackOnReorder =true;
                    rr.EnableDragAndDrop =true;
                   
                    List<int> i = new List<int>();
                    i.Add(1);
                    i.Add(2);
                    i.Add(3);
                    rr.DataSource = i;
                    rr.DataBind();
                    tCell.Controls.Add(rr);
                    tRow.Cells.Add((tCell));
                }
            }
        }
        ////
        class RadListBoxTemplate : ITemplate
        {
            public void InstantiateIn(Control container)
            {
                Label id = new Label();
                id.ID = "idLabel";
                id.CssClass = "idClass";
                id.DataBinding += new EventHandler(id_DataBinding);
                container.Controls.Add(id);
                Label name = new Label();
                name.ID = "nameLabel";
                name.CssClass = "list";
                name.DataBinding += new EventHandler(name_DataBinding);
                container.Controls.Add(name);
                HyperLink details = new HyperLink();
                details.ID = "details";
                details.CssClass = "list";
                details.Text = "Details";
                details.DataBinding += new EventHandler(details_DataBinding);
                container.Controls.Add(details);
            }
            private void id_DataBinding(object sender, EventArgs e)
            {
                //Label target = (Label)sender;
                //RadListBoxItem item = (RadListBoxItem)target.BindingContainer;
                //string id = Convert.ToString((int)DataBinder.Eval(item.DataItem, "ID"));
                //target.Text = id;
            }
            private void name_DataBinding(object sender, EventArgs e)
            {
                //Label target = (Label)sender;
                //RadListBoxItem item = (RadListBoxItem)target.BindingContainer;
                //string name = (string)DataBinder.Eval(item.DataItem, "Name");
                //target.Text = name;
            }
            private void details_DataBinding(object sender, EventArgs e)
            {
                //HyperLink target = (HyperLink)sender;
                //RadListBoxItem item = (RadListBoxItem)target.BindingContainer;
                //string id = Convert.ToString((int)DataBinder.Eval(item.DataItem, "ID"));
                //target.NavigateUrl = "Details.aspx?ID=" + id;
            }
        }
My .aspx like this :

  <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" CssClass="example-panel">
        <telerik:RadListBox ID="RadListBox1" CssClass="RadListBox1" runat="server" Width="200px"
            Height="200px" SelectionMode="Multiple" AllowTransfer="true" AutoPostBackOnTransfer="true"
            AllowReorder="true" AutoPostBackOnReorder="true" EnableDragAndDrop="true" Skin="Office2010Blue"
            OnDropped="RadListBox1_Dropped" OnDropping="RadListBox1_Dropping" OnTransferring="RadListBox1_Transferring">
            <Items>
                <telerik:RadListBoxItem Text="Argentina"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="Australia"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="Brazil"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="Canada"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="Chile"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="China"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="Egypt"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="England"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="France"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="Germany"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="India"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="Indonesia"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="Kenya"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="Mexico"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="New Zealand"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="South Africa"></telerik:RadListBoxItem>
            </Items>
        </telerik:RadListBox>
        <table id="Table1" runat="server" rules="Both">
        </table>
    </telerik:RadAjaxPanel>
Nencho
Telerik team
 answered on 13 Jun 2013
1 answer
101 views
I am having a big problem here. I have a class lib and a user control in there but I can not use the telerik intellisense the .ascx file. I did everything here http://www.telerik.com/community/forums/aspnet-mvc/general/cannot-use-telerik-intellisense-in-razor-views-when-these-views-are-in-class-library.aspx but this is not working. I have asp:.. intellisense but no intellisense for the telerik dll. Plese help me with this because It is a real stopper for me. Here is my web config file that I am placing in the class lib root and in the folder where is my user control. I also added the Telerik.Web.UI.dll to the GAC

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation>
      <assemblies>
        <add assembly="Telerik.Web.UI, Version=2012.3.1308.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/>
      </assemblies>
    </compilation>
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI, Version=2012.3.1308.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/>
      </controls>
      <namespaces>
        <add namespace="Telerik.Web.UI" />
      </namespaces>
    </pages>
  </system.web>
</configuration>

Please give me the exact steps that I should do.
ivan
Top achievements
Rank 1
 answered on 13 Jun 2013
2 answers
99 views
Hello,

I have the following RadGrid with a RadEditor embedded in it.  Everything works as expected, except when I change the color of the text in a RadEditor row, I am not able to add another row.  I don' receive any errors and I am able to  step through the btnAddInstruction_Click and grdInstructions_ItemDataBound events without any issues.  It just will not render another row.



btnAddInstruction_Click Code:
public static void AddInstructionGridRow(RadGrid gridName)
            {
                bool instructionIsNull = false;
                ProjectInstruction projectInstruction;
                List<ProjectInstruction> projectInstructions = new List<ProjectInstruction>();
                RadEditor txtInstruction;

                //  Iterate through the grid rows and retain all previously entered data.
                foreach (GridDataItem gridRow in gridName.Items)
                {
                    //  Create new Project Instruction object.
                    projectInstruction = new ProjectInstruction();

                    // Project ID (Hidden)
                    HiddenField hdnProjectID = gridRow.FindControl("hdnProjectID") as HiddenField;
                    if (hdnProjectID != null)
                    {
                        projectInstruction.ProjectID = Convert.ToInt32(hdnProjectID.Value);
                    }
                    else
                    {
                        projectInstruction.ProjectID = 0;
                    }

                    // Project Instruction ID (Hidden)
                    HiddenField hdnProjectInstructionID = gridRow.FindControl("hdnProjectInstructionID") as HiddenField;
                    if (hdnProjectInstructionID != null)
                    {
                        projectInstruction.ID = Convert.ToInt32(hdnProjectInstructionID.Value);
                    }
                    else
                    {
                        projectInstruction.ID = 0;
                    }

                    //  Project Instruction
                    txtInstruction = gridRow.FindControl("txtInstruction") as RadEditor;
                    if (txtInstruction.Content.Trim().Length == 0)
                    {
                        instructionIsNull = true;
                    }
                    projectInstruction.Instruction = txtInstruction.Content;

                    //  Add Project Instruction to Project Instructions object.
                    projectInstructions.Add(projectInstruction);
                }

                //  Create new Project Instruction object.
                if (!instructionIsNull)
                {
                    projectInstructions.Add(AddProjectInstruction());
                }

                //  Update Project Instructions grid.
                gridName.DataSource = projectInstructions;
                gridName.Rebind();
            }

grdInstructions_ItemDataBound
 protected void grdInstructions_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
            {
                //  Current row object.
                ProjectInstruction projectInstruction = (ProjectInstruction)e.Item.DataItem;
                string referenceNumber = string.Empty;

                //  Row Number
                GridDataItem dataItem = (GridDataItem)e.Item;
                referenceNumber = Convert.ToString(e.Item.ItemIndex + 1);
                dataItem["ReferenceNumber"].Text = referenceNumber;

                //  Project Instruction
                RadEditor txtInstruction = e.Item.FindControl("txtInstruction") as RadEditor;
                txtInstruction.Content = projectInstruction.Instruction;
                //txtInstruction.Languages.Add(new SpellCheckerLanguage("en-US", "English"));

                //  Delete Column               
                GridDataItem item = e.Item as GridDataItem;
                //  Display Delete option when adding new record and if there is more then one row.
                if (grdInstructions.MasterTableView.Items.Count > 0)
                {
                    //  Show Delete column during Add.
                    item["btnDeleteInstructionRow"].Controls[0].Visible = true;
                    item["btnDeleteInstructionRow"].Attributes["onclick"] = "return confirm('Delete Instruction# " +  referenceNumber + "?')";
                }
                else
                {
                    //  Hide Delete option if there is only one row.
                    item["btnDeleteInstructionRow"].Controls[0].Visible = false;
                }
            }
        }

Can you please tell  me what is causing another row not to be rendered when HTML color formatting is applied to the text in a RadEditor row?

Thank Very Much in Advance!
Pavlina
Telerik team
 answered on 13 Jun 2013
1 answer
90 views
In chrome the styles are off on some of the skins

- Silk the close x is not centered in the circle
- metro the callout doesn't look like it belongs, kinda hangs out the top a bit
Bozhidar
Telerik team
 answered on 13 Jun 2013
1 answer
136 views
Is it possible for me to populate a dropdown menu with the column names from my radgrid and use the dropdown menu to sort the grid (along with radio buttons to select ascending or descending), as opposed to using column headers to sort?
Princy
Top achievements
Rank 2
 answered on 13 Jun 2013
1 answer
101 views
Hi,

I have recently updated a webpart which worked in SP2010 to SP2013, the upgrade process was changing the target framework and referencing the telerik.ui for 4.5

After deploying the webpart into SP2013, i'm now getting this error:

"that assembly does not allow partially trusted callers"

I assume its to do with the changes in 4.5 security? has anyone experienced the same issue?

I'd like to avoid putting the telerik.dll's in the GAC

Thanks
Nencho
Telerik team
 answered on 13 Jun 2013
3 answers
154 views
I have a grid and i am applying sorting on the columns on client side using this code :

<script type="text/javascript">
    function AddSortExpression(grid, fieldName, sortOrder) {
        var sortExpression = new Telerik.Web.UI.GridSortExpression();
        sortExpression.set_fieldName(fieldName);
        sortExpression.set_sortOrder(sortOrder);
        grid.get_masterTableView()._sortExpressions.add(sortExpression);
        grid.get_masterTableView()._showSortIconForField(fieldName, sortOrder);
    }
</script>

The code works fine for a single column sorting but if there are two columns
to be sorted then sorting gets applied on the two columns and the column header
color changes to denote that but the little black triangle which denotes whether
it is a ascending or descending sort vanishes. I have attached the image of how
the header looks.

Please help me out.

Angel Petrov
Telerik team
 answered on 13 Jun 2013
1 answer
149 views
    Hello.
I`m using RadGrid populating data in OnNeedDataSource.
I want to check row count on client side before exporting and if row count is greater than 100000 (for examle) I want to show  Alert('Can`t exporf data, please specify another criteria')
How can I do this? What client event use? How to check row count on client side?
Princy
Top achievements
Rank 2
 answered on 13 Jun 2013
0 answers
119 views
i have issue with datetime picker in radscheduler. I have a custom time starting from 04:00 Am and it has interval of 30 min i have a function that returns all the time starting from 04:00 am and goes till 03:30 on 24 hour. But when i bind this time with either datetime picker or time picker it shows time starting from 12:00 Am and when i click 12:00 am it populates the datetime picker time with 04:00 am.i don't know what's going on. Can anyone help me with this.
Ashesh
Top achievements
Rank 1
 asked on 12 Jun 2013
1 answer
602 views
Hello,

I'm trying to implement a RadScheduler. I have it all set up with an appointment data source with two resource (room and user) data sources. I autogenerated the insert/update/delete commands for the appointment data source. Whenever I try to create a new appointment I get the following error (even though I only have 9 parameters...):

[OleDbException (0x80040e21): Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.]
  
[InvalidOperationException: Command parameter[9] '' is invalid.
Command parameter[10] '' is invalid.
Command parameter[11] '' is invalid.
]
   Telerik.Web.UI.Scheduling.DataSourceViewSchedulerProvider.OnDataSourceOperationComplete(Int32 count, Exception e) +39
   System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +72
   Telerik.Web.UI.Scheduling.DataSourceViewSchedulerProvider.Insert(RadScheduler owner, Appointment appointmentToInsert) +202
   Telerik.Web.UI.SchedulerProviderBase.Insert(ISchedulerInfo schedulerInfo, Appointment appointmentToInsert) +70
   Telerik.Web.UI.Scheduling.AppointmentController.InsertAppointmentThroughProvider(ISchedulerInfo schedulerInfo, Appointment appointment) +109
   Telerik.Web.UI.Scheduling.AppointmentController.InsertAppointment(ISchedulerInfo schedulerInfo, Appointment appointment) +40
   Telerik.Web.UI.RadScheduler.InsertAppointmentInline() +303
   Telerik.Web.UI.RadScheduler.OnBubbleEvent(Object source, EventArgs args) +505
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +121
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +156
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9643314
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

Here is my Default.aspx code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
  
<!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>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body style="height: 459px">
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" 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>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
  
        // Avoid Page_Validators is undefined error.
        var Page_Validators = new Array();
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
  
    </div>
        <telerik:RadScheduler ID="RadScheduler1" runat="server" DataDescriptionField="Description" DataEndField="End_Time" DataKeyField="AppointmentID" DataRecurrenceField="Recurrence_Rule" DataRecurrenceParentKeyField="RecurrenceParentID" DataSourceID="SqlDataSource_Appointment" DataStartField="Start_Time" DataSubjectField="Subject" DayEndTime="19:00:00" DayStartTime="07:00:00" StartInsertingInAdvancedForm="True" WorkDayStartTime="09:00:00" Height="600px" SelectedView="MonthView">
            <ResourceTypes>
                <telerik:ResourceType DataSourceID="SqlDataSource_Resource" ForeignKeyField="RoomID" KeyField="ResourceID" Name="Rooms" TextField="RoomName" />
                <telerik:ResourceType DataSourceID="SqlDataSource_Employee" ForeignKeyField="EmployeeID" KeyField="EmployeeID" Name="Employees" TextField="UserName" />
            </ResourceTypes>
            <WeekView DayStartTime="07:00:00" WorkDayStartTime="09:00:00" />
            <DayView DayStartTime="07:00:00" WorkDayStartTime="09:00:00" />
            <MultiDayView DayStartTime="07:00:00" WorkDayStartTime="09:00:00" />
        </telerik:RadScheduler>
        <asp:SqlDataSource ID="SqlDataSource_Employee" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString_mgsql2 %>" ProviderName="<%$ ConnectionStrings:ConnectionString_mgsql2.ProviderName %>" SelectCommand="SELECT [EmployeeID], [UserName] FROM [Employee] ORDER BY [UserName]"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource_Appointment" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString_mgsql2 %>" ProviderName="<%$ ConnectionStrings:ConnectionString_mgsql2.ProviderName %>" SelectCommand="SELECT * FROM [Appointment]" DeleteCommand="DELETE FROM [Appointment] WHERE [AppointmentID] = ?" InsertCommand="INSERT INTO [Appointment] ([AppointmentID], [Subject], [Description], [Start], [End], [RoomID], [EmployeeID], [RecurrenceRule], [RecurrenceParentID]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)" UpdateCommand="UPDATE [Appointment] SET [Subject] = ?, [Description] = ?, [Start] = ?, [End] = ?, [RoomID] = ?, [EmployeeID] = ?, [RecurrenceRule] = ?, [RecurrenceParentID] = ? WHERE [AppointmentID] = ?">
            <DeleteParameters>
                <asp:Parameter Name="AppointmentID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="AppointmentID" Type="Int32" />
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="Start" Type="DateTime" />
                <asp:Parameter Name="End" Type="DateTime" />
                <asp:Parameter Name="RoomID" Type="Int32" />
                <asp:Parameter Name="EmployeeID" Type="Int32" />
                <asp:Parameter Name="RecurrenceRule" Type="String" />
                <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="Start" Type="DateTime" />
                <asp:Parameter Name="End" Type="DateTime" />
                <asp:Parameter Name="RoomID" Type="Int32" />
                <asp:Parameter Name="EmployeeID" Type="Int32" />
                <asp:Parameter Name="RecurrenceRule" Type="String" />
                <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
                <asp:Parameter Name="AppointmentID" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource_Resource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString_mgsql2 %>" ProviderName="<%$ ConnectionStrings:ConnectionString_mgsql2.ProviderName %>" SelectCommand="SELECT * FROM [Resource]"></asp:SqlDataSource>
    </form>
</body>
</html>

Please help me!

Thanks,
Matt
Matt
Top achievements
Rank 1
 answered on 12 Jun 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?