Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
202 views
Hi,

I am loading a grid with data and attaching to the SelectedIndexChanged event. When the grid is loaded I want to select the first row and have the code in the SelectedIndexChanged handler run. The only way I can manage this is to explicitly call the handler.

My C# code is as follows:

protected void grdTicket_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
    DataSet ds = new DataSet();
    DataTable dt = new DataTable();
    dt.Columns.Add("UserId");
 
    for (int i = 0; i < 15; i++)
    {
        DataRow dr = dt.NewRow();
        dr["UserId"] = "XYZ" + i.ToString();
        dt.Rows.Add(dr);
    }
 
    ds.Tables.Add(dt);
    grdTicket.DataSource = ds;
}
 
protected void grdTicket_PreRender(object sender, EventArgs e)
{
    RadGrid grid = sender as RadGrid;
 
    if (grid.MasterTableView.Items.Count > 0)
    {
        if (grid.SelectedIndexes.Count == 0)
        {
            //grid.SelectedIndexes.Add(0);
            grid.MasterTableView.Items[0].Selected = true;
 
            // This just feels dirty!!
            // Why doesn't the event fire when I set the row's Selected property
            grdTicket_SelectedIndexChanged(sender, null);
        }
    }
}
 
protected void grdTicket_SelectedIndexChanged(object sender, EventArgs e)
{
    RadGrid grid = sender as RadGrid;
    int index = Convert.ToInt32(grid.SelectedIndexes[0]);
    lblSelectedIndex.Text = "Selected index = " + index;
}

and my HTML is:

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<telerik:RadGrid ID="grdTicket" runat="server" AutoGenerateColumns="false" Width="946px"
    Font-Names="Verdana" Font-Size="x-small" EnableViewState="true" AllowSorting="true"
    AllowPaging="true" AllowMultiRowSelection="false" OnNeedDataSource="grdTicket_NeedDataSource"
    OnPreRender="grdTicket_PreRender" OnSelectedIndexChanged="grdTicket_SelectedIndexChanged">
    <ClientSettings EnablePostBackOnRowClick="True">
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
    <MasterTableView Width="100%" NoDetailRecordsText="No Records To Display">
        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
        </RowIndicatorColumn>
        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn HeaderText="User ID" DataField="UserId" UniqueName="UserID">
            </telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
    <PagerStyle Mode="NextPrevNumericAndAdvanced" ShowPagerText="true" />
    <FilterMenu EnableImageSprites="False">
    </FilterMenu>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
    </HeaderContextMenu>
</telerik:RadGrid>
<br />
<asp:Label runat="server" ID="lblSelectedIndex" />

Can anyone tell me what I need to change to get this to work without the need to call the handler directly?

Thanks,

David
Mark
Top achievements
Rank 1
 answered on 29 Jul 2011
3 answers
168 views
Hi,
I have a radGrid in a formView. In my formView there is a radStrip with 2 pageView. In the first there are some telerik controls, in the second there is a radGrid. I haven't any problem when the page is loaded and the data are loaded from DB. The problem occurs after a postback, for example after a button click: when the page is reloaded I have this error message:

Script control 'PageSizeComboBox' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl


If I delete the pagerStyle in my asp page for a test, the problem is on another control

Script control 'rfltMenu' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl

Someone can help me?
Thanks
Francesco
Top achievements
Rank 1
 answered on 29 Jul 2011
10 answers
150 views
Hello
I am studying how to make a custom advanced form here:  http://demos.telerik.com/aspnet-ajax/scheduler/examples/advancedformtemplate/defaultvb.aspx

I have a question about this part:
<scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit"
     Subject='<%# Bind("Subject") %>'
     Description='<%# Bind("Description") %>'
     Start='<%# Bind("Start") %>'
     End='<%# Bind("End") %>'
     RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'
    Reminder='<%# Bind("Reminder") %>'
     AppointmentColor='<%# Bind("AppointmentColor") %>'
     UserID='<%# Bind("User") %>'
     RoomID='<%# Bind("Room") %>' />

How is the RecurrenceParentID passed to the RadSchedulerRecurrenceEditor? Also, how is the primary key bound? (With the built in advance form it's DataKeyField="Schedule_id" for my RadScheduler)

Note: I am binding in my codebehind after every postback using an object based on this: http://www.telerik.com/help/aspnet-ajax/scheduler-using-datasource-property.html
So the binding in my codebehind is like:
Private Sub BindSchedule()
    Dim ds As List(Of objCRM.Schedule) = objCRM.Schedule.SelectScheduleByUser(Session("User_id"))
    Scheduler.DataSource = ds
    Scheduler.DataBind()
End Sub

Here is how my RadScheduler is currently defined:
<rad:RadScheduler runat="server" ID="Scheduler" Width="753px" Height="600px"
        EnableExactTimeRendering="true" StartEditingInAdvancedForm="true" StartInsertingInAdvancedForm="true"
        DataKeyField="Schedule_id" 
        DataStartField="Start"
        DataEndField="End"
        DataSubjectField="Subject"
        DataDescriptionField="Description"
        DataRecurrenceField="RecurrenceRule"
        DataReminderField="Reminder"
        DataRecurrenceParentKeyField="RecurrenceParentSchedule_id"
        AppointmentContextMenuSettings-EnableDefault="false"
        TimeSlotContextMenuSettings-EnableDefault="false"
        TimelineView-UserSelectable="false" >
    <AdvancedForm Modal="true" />
    <Reminders Enabled="True" />
</rad:RadScheduler>

Also I'm using 2011.1.519.40 of the dll.

Thanks,
Dan
Peter
Telerik team
 answered on 29 Jul 2011
5 answers
169 views

I have a user control that uses a custom control which has business logic to added controls dynamically. Example text boxes along with lable will be added based on the rule to capture addtional information from user.

If the user control is part of page and displayed using RadWindow then the I do not have any issues and on each post back between client and server dynamically added controls are getting displayed.

When the same user control is displayed inline using "User Control Edit Form" then for the first time dynamically added controls are getting displayed, but on the further post back they are not getting displayed.

In the custom control i am using CreateChildControls() to add controls dynamically.

Daniel
Telerik team
 answered on 29 Jul 2011
3 answers
48 views
Hi,

I'm working on hotel booking application. I have page containing scheduler in month view and it shows when particular room is booked. I'm trying to handle the situation when for example one guest leaves the room at 10 am and second one arrives at 2 pm. I guess this could be done by adjusting appointment width according to its duration. But is it possible in month view?

Basically, I'd like to get something like in attached image.

Thanks,
Mikolaj
Peter
Telerik team
 answered on 29 Jul 2011
1 answer
138 views
I'm new to Telerik and feel like I'm trying to do something advanced for my first real assignment.  What I'm trying to do is use a RadTreeList to manage options for a item where the entire list will be in edit mode (from the start and only used in edit mode).  I'd like to be able to use the select column to allow for recursive selections and I would like to have text boxes with the detailed items at the "base" of the tree.  I've tried to give an example below, but I don't know that it does what I need justice.

Another important factor is that this RadTreeList appears within a (pop-up) UserControl that is the Edit for a RadGrid.

Let me know if you need anything else to assist with my question.  Thank you.


Checkbox     Top Level     Sub Level   Item   TextBox1   TextBox2
[Checkbox]   Top Level 1
[Checkbox]                       Sub Level 1
[Checkbox]                                          ABC   [Textbox]   [Textbox]
[Checkbox]                                          EDF   [Textbox]   [Textbox]
[Checkbox]                                          PLK   [Textbox]   [Textbox]
[Checkbox]                       Sub Level 2
[Checkbox]                                          QWE   [Textbox]   [Textbox]
[Checkbox]                                          PLL   [Textbox]   [Textbox]
[Checkbox]   Top Level 2
[Checkbox]                       Sub Level 1
[Checkbox]                                          ZCV   [Textbox]   [Textbox]
[Checkbox]                                          IKJ   [Textbox]   [Textbox]
[Checkbox]                                          ESD   [Textbox]   [Textbox]
[Checkbox]                       Sub Level 2
[Checkbox]                                          ESM   [Textbox]   [Textbox]
[Checkbox]                                          GHD   [Textbox]   [Textbox]
Marin
Telerik team
 answered on 29 Jul 2011
1 answer
83 views
Hello,
I have a grid with a page size of 10 rows. When I groups the grid it groups only the records of the page, is there any way to group records more than just the current page and show it?

Like this grid http://demos.devexpress.com/ASPxGridViewDemos/GroupingSorting/Grouping.aspx

thanks!!!
Princy
Top achievements
Rank 2
 answered on 29 Jul 2011
6 answers
153 views

What I've done is built a "SmartPart" application in SharePoint 2007 which I'm trying to convert to SharePoint 2010. If you're not familiar with SmartPart, it's essentially a wrapper webpart that lets you load .ascx controls from a designated folder on the SharePoint server.

I've used Telerik controls within a series of .ascx controls. In 2007 everything works fine. In SharePoint 2010 I'm experiencing a ScriptHandler.axd "object expected" error whenever I trigger a partial postback to change the mode on a DetailsView control from ReadOnly to Edit or Insert. Changing from Edit/Insert back to ReadOnly, or loading the page with the DetailsView already in Edit/Insert mode does not cause the error.

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Timestamp: Tue, 15 Feb 2011 18:25:21 UTC

Message: Object expected
Line: 5
Char: 32749
Code: 0
URI: http://myHost/ScriptResource.axd?d=5IJVuvjGYmphMWCAkLfCmwAPXrthSXiUWcsZ2-XJPFVyLeGXjv_VkQVwhs7Rbfagz910Hn9YGXyPmImRLglJdlDX3fR00mQLdqSAApxlnZ4LBCFPJ4ROQskZ8-rvBIOcVRyr6yuAXk__TG9yo6erRI62vE01&t=5c2f384e

 
The DetailsView control is using DynamicFields which are constructed from DynamicData FieldTemplates. In these field templates I'm using Telerik controls such as RadTextBox, RadTooltip, RadDateTimePicker, etc. Those controls are what cause the error after a partial postback. As I said, if I load the page in edit/insert mode to begin with, everything is fine. However if I load the page in ReadOnly mode, then trigger a partial postback which causes the DynamicFields to switch from ASP Labels into Telerik Controls the error happens. I want to reiterate that this worked fine in MOSS 2007.

I also found that the ScriptResource it's referring to is MicrosoftAJAX.js, but I'm not sure what it's expecting at Char 32749. Any ideas?

Tsvetoslav
Telerik team
 answered on 29 Jul 2011
1 answer
73 views
How to drag to Select area cell?


Thanks in advance!
Shinu
Top achievements
Rank 2
 answered on 29 Jul 2011
2 answers
211 views
I am using a radcombox with loadondemand and allowcustomtext = true. After Form submit the use is redirected to another page. Now if the browser back button is pressed then the selected value in the dropdown is lost. How can the value be persisted just like a regular texbox or dropdown?

 <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">
  <telerik:RadComboBox ID="Operating_Unit" runat="server" Width="250px" Height="150px"
                
                
                 EmptyMessage="" EnableLoadOnDemand="True"  AllowCustomText="true" OnItemsRequested="operating_unit_ItemsRequested"   ShowMoreResultsBox="true" 
                    EnableVirtualScrolling="true"  
                >
            </telerik:RadComboBox>
<asp:Button ID="btn" runat="server" Text="button" onclick="btn_Click" />
</telerik:RadAjaxPanel>

Princy
Top achievements
Rank 2
 answered on 29 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?