Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
260 views
Hi,
 I am using rad window , it display the textbox which creates dynamically.

I am using the below code.

 
function openWin() {
          var docId = document.getElementById('cpEditor_hdnDocId').value;
          var oWnd = $find("<%= radPropertyInspector.ClientID %>");
          oWnd.setUrl("NZFPropertyInspector.aspx?docId=" + docId);
          oWnd.show();
      }
it works well.

But, my problem is , once i close the window with some value in text box in in rad window,

again i open the rad window, it shows the previous value of text boxes, then reload the new text box values.

Text boxes are created dynamically.

i need to empty the textbox before showing the rad window.

How to clear the values of item before loading?

Thanks,
Uma
Princy
Top achievements
Rank 2
 answered on 25 Jan 2012
1 answer
49 views
I have a RadGrid that is bound in the code behind, on on ItemDataBound I'm doing binding to a RadComboBox that is within a TemplateColumn inside the grid:
 
<tel:RadGrid runat="server" ID="rgCounties" OnItemCommand="rgCounties_ItemCommand"
    AutoGenerateColumns="False" OnItemDataBound="rgCountes_ItemDataBound" AllowMultiRowEdit="True"
    CellSpacing="0" GridLines="None">
    <MasterTableView>
        <Columns>
            <tel:GridBoundColumn Display="false" DataField="ID" UniqueName="SectionCountyID"  />
            <tel:GridTemplateColumn HeaderText="County" UniqueName="CountyColumn">
                <InsertItemTemplate>
                    <tel:RadComboBox runat="server" ID="rgrcCounty" DataTextField="CountyName" DataValueField="ID" />
                </InsertItemTemplate>
                <ItemTemplate>
                    <tel:RadComboBox runat="server" ID="rgrcCounty" DataTextField="CountyName"
                        DataValueField="ID" />
                </ItemTemplate>
            </tel:GridTemplateColumn>
        </Columns>
    </MasterTableView>
</tel:RadGrid>

So they can edit the County Dropdown at will, and click a save button below.
The county dropdown is being populated from a database table, but only has entries that are not currently in the grid.

For instance, Suppose i have 5 Counties:
{Lancaster, York, Berks, Adams, Allegheny}
the Grid has 3 entries for the counties "York, Adams, Allegheny".  Therefore, each combo box should have the two that are not present anywhere in the grid (Lancaster, Berks), as well as one entry for that grid row

So the grid would look like this:
Row 1: Combo with options {Lancaster, Berks, York}
Row 2: Combo with options {Lancaster, Berks, Adams}
Row 3: Combo with options {Lancaster, Berks, Allegheny}

However, the results I'm getting are:
Row 1: Combo with options {Lancaster, Berks, York}
Row 2: Combo with options {Lancaster, Berks, York, Adams}
Row 3: Combo with options {Lancaster, Berks, York, Adams, Allegheny}

Even though on Each row I'm rebinding the combobox and adding the missing one.
protected void rgCountes_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        var ditem = e.Item as GridDataItem;
        var combo = ((RadComboBox)ditem["CountyColumn"].FindControl("rgrcCounty"));
        var sectionCountyID = int.Parse(ditem["SectionCountyID"].Text);
        var sectionCounty = Model.SectionCounties.Where(sc => sc.ID == sectionCountyID).FirstOrDefault();
 
        combo.Bind(Model.Counties, false);
        if (sectionCounty != null)
        {
            combo.AddOrSelectByValue(sectionCounty.CountyID.ToString(), sectionCounty.County.CountyName);
            rnt.Text = sectionCounty.Percentage.ToString();
        }
    }    
}
        public static bool AddOrSelectByValue(this RadComboBox combo, string value, string text)
        {
            bool tf = combo.SelectByValue(value);
            if (!tf)
            {
                combo.Items.Add(new RadComboBoxItem(text, value));
                combo.SelectByValue(value);
            }
            return tf;
        }


You can see I'm rebinding each combo and then adding a new value on a per-row basis. But it seems that on each row, thecombo.Items.Add() is being applied additively.

Any idea what I'm doing wrong or how to fix it?

thanks!
Iana Tsolova
Telerik team
 answered on 25 Jan 2012
1 answer
84 views
I am trying to have a grid allow me to drag and drop rows. I can get it to allow me to drag it but it doesn't save it in the new place. I'm also going to want to write it out to the database so the values are saved.

I've read all kinds of things that seem WAY to complicated - there must be an easy way to do it.

Can somebody point me in the right direction.

TIA - Jeff.
Shinu
Top achievements
Rank 2
 answered on 25 Jan 2012
14 answers
427 views

Since the most useful part of RadAjaxManager is the UI for defining AjaxSettings that go along with it, why not create something similar to ScriptManager and ScriptManagerProxy?  This way, individual controls could have a ScriptManagerProxy, where they can define their own internal settings and update controls and then the content page (or master page) could have the top level RadAjaxManager that would aggregate all the RadAjaxManagerProxy controls from all child controls and content pages.

Thoughts?

Nick
Top achievements
Rank 1
 answered on 25 Jan 2012
1 answer
63 views
I have a RadScheduler with intervals of 30 minutes.
I am trying to validate when the user moves an appointmente to another timeslot. I am using OnClientAppointmentMoveEnd to check the new timeslot and the new startime.
The problem is that when the user drags the appointment to, for example, 15:30, the "eventArgs.get_newStartTime()" returns "15:01".
If it drags to slot "15:00" it also shows "15:01". Why is that?
Here is a sample code where I am just trying to show a message asking the user to confirm the changes in the schedule and in the resource.

function OnClientAppointmentMoveEnd(sender, eventArgs) {
                 
                var apt = eventArgs.get_appointment();
                var msg = "";
                var novadata = eventArgs.get_newStartTime();
                if (apt.get_start() != novadata) {
                    msg = "New Schedule:" + novadata.format("HH:MM") + "\r\n";
                }
 
                if (apt.get_timeSlot().get_resource(0).get_key() != eventArgs.get_targetSlot().get_resource(0).get_key()) {
                    msg = msg + "New therapist:" + eventArgs.get_targetSlot().get_resource(0).get_text() + "\r\n";
                }
 
                if (confirm(msg + "Confirm change?" )) {
                 
                }
                else {
                    set_cancel(true);
                }
               
                 
                                 
            }

Any ideia? Thanks.
sotero
Top achievements
Rank 1
 answered on 24 Jan 2012
1 answer
111 views
Hello,

Is there a way to customize the tooltip ?

Thanks
Aurore
Richard
Top achievements
Rank 1
 answered on 24 Jan 2012
4 answers
176 views
Hi folks,

I use the ItemTemplate and put a DropDownList in the RadListBox. Meanwhile I set the EnableDragAndDrop to true for the RadListBox. Then the DropDownList does not work in IE9 and Chrome. However It works in FireFox, IE8, IE7. Did anyone encounter the same problem and know how to solve it? Any help would be appreciated.

Chris
Chris
Top achievements
Rank 1
 answered on 24 Jan 2012
4 answers
497 views
I have a RadGrid in a RadWindow.  When I try to filter the grid it does a postback and throws this exception:

[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +9792
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

I found that if I put another RadGrid on the page not in a RadWindow and filter it first, then filter the RadGrid in the window, it works correctly.

To reproduce: click "Open RadWindow", enter "5" in Title filter, click the filter icon for the Title column and select "Contains"

Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="RadGridTest.aspx.vb" Inherits="RadGridTest" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Charting" 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">
        </asp:ScriptManager>
        <a href="javascript:$find('RadWindow1').show();">Open RadWindow</a>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="True" VisibleTitlebar="true" VisibleStatusbar="false">
            <Windows>
                <telerik:RadWindow ID="RadWindow1" runat="server" Title="Change Dashboard" Width="500" Modal="true">
                    <ContentTemplate>
                        <telerik:RadGrid ID="RadGrid1" runat="server" PageSize="10" AllowPaging="true" AllowSorting="true">
                            <GroupingSettings CaseSensitive="false" />
                            <MasterTableView AutoGenerateColumns="false" AllowFilteringByColumn="true">
                                <Columns>
                                    <telerik:GridTemplateColumn AllowFiltering="false">
                                        <ItemTemplate>
                                            <asp:HyperLink ID="lnkSelect" runat="server" NavigateUrl='/Default.aspx'>Select</asp:HyperLink>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridBoundColumn HeaderText="Title" DataField="Title" SortExpression="Title" />
                                    <telerik:GridBoundColumn HeaderText="Description" DataField="Description" SortExpression="Description" />
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>
                    </ContentTemplate>
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>
    </div>
    <div>
        <telerik:RadGrid ID="RadGrid2" runat="server" PageSize="10" AllowPaging="true" AllowSorting="true">
            <GroupingSettings CaseSensitive="false" />
            <MasterTableView AutoGenerateColumns="false" AllowFilteringByColumn="true">
                <Columns>
                    <telerik:GridTemplateColumn AllowFiltering="false">
                        <ItemTemplate>
                            <asp:HyperLink ID="lnkSelect" runat="server" NavigateUrl='/Default.aspx'>Select</asp:HyperLink>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn HeaderText="Title" DataField="Title" SortExpression="Title" />
                    <telerik:GridBoundColumn HeaderText="Description" DataField="Description" SortExpression="Description" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>

Imports Telerik.Web.UI
Imports Telerik.Charting
Imports System.Data
Partial Class RadGridTest
    Inherits System.Web.UI.Page
 
    Private Shared Function GetGridDataTable() As DataTable
        Dim GridDataTable As New DataTable()
        GridDataTable.Columns.Add(New DataColumn("Title", System.Type.GetType("System.String")))
        GridDataTable.Columns.Add(New DataColumn("Description", System.Type.GetType("System.String")))
        For i As Integer = 0 To 4
            Dim Row As DataRow = GridDataTable.NewRow()
            Row.SetField("Title", "Title " & i)
            Row.SetField("Description", "Description " & i)
            GridDataTable.Rows.Add(Row)
        Next
        Return GridDataTable
    End Function
 
    Protected Sub RadGrid1_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
        RadGrid1.DataSource = GetGridDataTable()
    End Sub
 
    Protected Sub RadGrid2_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid2.NeedDataSource
        RadGrid2.DataSource = GetGridDataTable()
    End Sub
End Class

BrianS
Top achievements
Rank 1
 answered on 24 Jan 2012
3 answers
382 views
Hello,

I get an error when I try to sort the data in the grid.


The error is

Server Error in '/' Application.

Operation is not valid due to the current state of the object.

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.InvalidOperationException: Operation is not valid due to the current state of the object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: Operation is not valid due to the current state of the object.]
   System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +2692302
   System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +61
   System.Web.HttpRequest.FillInFormCollection() +148

[HttpException (0x80004005): The URL-encoded form data is not valid.]
   System.Web.HttpRequest.FillInFormCollection() +206
   System.Web.HttpRequest.get_Form() +68
   System.Web.HttpRequest.get_Item(String key) +39
   Telerik.Web.UI.RadCompression.IsAjaxRequest() +59
   Telerik.Web.UI.RadCompression.Compress(HttpApplication application) +720
   Telerik.Web.UI.RadCompression.PreRequestHandlerExecute(Object sender, EventArgs e) +76
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


My radgrid Setting
    <telerik:RadGrid ID="gridReports_Telerik" runat="server"  
                EnableAjaxSkinRendering="true"
                GridLines="Horizontal" CellPadding="0" BorderStyle="None"
                ClientSettings-AllowColumnHide="true" ClientSettings-EnableRowHoverStyle="true"
                ShowStatusBar="true" ShowHeader="true" AllowSorting="true"
                ShowFooter="true" RegisterWithScriptManager="true"
                EnableViewState="true"
                AllowFilteringByColumn="false"
                AllowMultiRowSelection="true"
                FilterItemStyle-Width="40" >
        <PagerStyle Mode="NextPrevAndNumeric" />
        <GroupingSettings CaseSensitive="false" ShowUnGroupButton="true" />
        <MasterTableView TableLayout="Fixed" NoMasterRecordsText="No Record" >
        </MasterTableView>
        <HeaderStyle Height="50px" />
        <ClientSettings>
            <Scrolling EnableVirtualScrollPaging="false" />
            <Scrolling AllowScroll="true" UseStaticHeaders="true" />
            <Selecting AllowRowSelect="true" EnableDragToSelectRows="true" />
            <Resizing AllowColumnResize="true" EnableRealTimeResize="false"  ShowRowIndicatorColumn="false"
                      ResizeGridOnColumnResize="true" AllowRowResize="false" ClipCellContentOnResize="false" />
            
        </ClientSettings>
    
    </telerik:RadGrid>



I have used the httprequest to get some parameter from the url, so that the page url is http://xxx.com/test.aspx?operation=1&......
But the error message told that the URL encode is not valid.
What is the cause of the error and how to solve it? Thank you.

Regards,
Kev
Richard
Top achievements
Rank 1
 answered on 24 Jan 2012
2 answers
483 views
Howdy,

I'm writing some functionality that lists events for a specific date.  The date I am using is the radScheduler.SelectedDate. 

My question is about setting the radScheduler.SelectedDate.  Whenever you change it on the date selector, it doesn't seem to automatically change the radScheduler.SelectedDate . The radScheduler.SelectedDate gets set when some other event is fired (i.e. changing to day view, month view, etc.....) 

Is there a way to set the radScheduler.SelectedDate when the dateSelector event change?

Any help would be appreciated. 

Thanks!

Justin
Justin
Top achievements
Rank 1
 answered on 24 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?