Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
95 views
Hi,
     I have a list of resources that are organized by categories (i.e. several different cabins that belong to a lodging category and several different conference rooms that belong to a meeting rooms category). I would like to show these resources on the y axis in a timeline view but be able to expand/collapse them by category kind of like in a tree view. When collapsed, their appointments would not show. This would save a lot of screen real estate since I have so many resources. Is this possible using the RadScheduler?

Many Thanks,
Oleg
Plamen
Telerik team
 answered on 09 Dec 2013
1 answer
175 views
The issue is that a RadGrid that is created dynamically in the ItemCommand event of the parent grid is not firing commands correctly.

A RadGrid that is explicitly defined within the NestedViewTemplate works perfectly.

To demonstrate, I've created the following...   RadGridChild is explicitly defined within the "ChildPane" panel in the NestedViewTemplate.  It's events fire just as expected.

<telerik:RadScriptManager ID="ScriptManager1" runat="server" />
<telerik:RadAjaxManager ID="AjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGridMaster">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGridMaster" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid ID="RadGridMaster" runat="server" OnNeedDataSource="RadGridMaster_NeedDataSource"
    OnPreRender="RadGridMaster_PreRender" OnItemCommand="RadGridMaster_ItemCommand"
    OnItemCreated="RadGridMaster_ItemCreated">
    <MasterTableView DataKeyNames="ItemID">
        <Columns>
        </Columns>
        <NestedViewSettings DataSourceID="ItemID">
            <ParentTableRelation>
                <telerik:GridRelationFields DetailKeyField="ItemID" MasterKeyField="ItemID" />
            </ParentTableRelation>
        </NestedViewSettings>
        <NestedViewTemplate>
            <asp:Panel ID="ChildPanel" runat="server">
                <telerik:RadGrid ID="RadGridChild" runat="server" OnNeedDataSource="RadGridChild_NeedDataSource"
                    OnItemCommand="RadGridChild_ItemCommand">
                    <MasterTableView DataKeyNames="DetailItemID" CommandItemDisplay="Top">
                        <CommandItemSettings AddNewRecordText="Add Detail" />
                        <Columns></Columns>
                    </MasterTableView>
                </telerik:RadGrid>
            </asp:Panel>
        </NestedViewTemplate>
    </MasterTableView>
</telerik:RadGrid>

Here's the code:
public partial class TestGrid : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void RadGridMaster_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        using (TestDataEntities de = new TestDataEntities())
        {
            (sender as RadGrid).DataSource = de.Table1.ToList();
        }
    }
 
    protected void RadGridMaster_PreRender(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            RadGridMaster.MasterTableView.Items[0].Expanded = true;
            var pnl = RadGridMaster.MasterTableView.Items[0].ChildItem.FindControl("ChildPanel") as Panel;
            pnl.Visible = true;
            pnl.Controls.OfType<RadGrid>().FirstOrDefault().Rebind();
        }
    }
 
    protected void RadGridMaster_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item is GridDataItem)
        {
            ((GridDataItem)e.Item).ChildItem.FindControl("ChildPanel").Visible =
                !e.Item.Expanded;
            if (!e.Item.Expanded)
            {
                (((GridDataItem)e.Item).ChildItem.FindControl("ChildPanel") as Panel).Controls.OfType<RadGrid>().FirstOrDefault().Rebind();
 
                RadGrid RadGridChild2 = new RadGrid();
                RadGridChild2.ID = "RadGridChild2";
                RadGridChild2.NeedDataSource += RadGridChild2_NeedDataSource;
                RadGridChild2.ItemCommand += RadGridChild2_ItemCommand;
                RadGridChild2.MasterTableView.DataKeyNames = new string[] { "ItemID" };
                RadGridChild2.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
                RadGridChild2.MasterTableView.CommandItemSettings.AddNewRecordText = "Add for 2";
                RadGridChild2.AutoGenerateColumns = false;
                RadGridChild2.MasterTableView.Columns.Add(new GridBoundColumn() { DataField = "DetailItemID", HeaderText = "Detail ID" });
                RadGridChild2.MasterTableView.Columns.Add(new GridBoundColumn() { DataField = "ItemDetail", HeaderText = "Detail" });
                (((GridDataItem)e.Item).ChildItem.FindControl("ChildPanel") as Panel).Controls.Add(RadGridChild2);
                RadGridChild2.Rebind();
            }
        }
    }
 
    protected void RadGridMaster_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridNestedViewItem)
        {
            e.Item.FindControl("ChildPanel").Visible = ((GridNestedViewItem)e.Item).ParentItem.Expanded;
        }
    }
 
    protected void RadGridChild_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        RadGrid rg = sender as RadGrid;
        var temp = Convert.ToInt32((rg.NamingContainer as GridNestedViewItem).ParentItem.GetDataKeyValue("ItemID"));
 
        using (TestDataEntities de = new TestDataEntities())
        {
            rg.DataSource = de.Table2.Where(x => x.ItemID == temp).ToList();
        }
    }
 
    protected void RadGridChild_ItemCommand(object sender, GridCommandEventArgs e)
    {
        RadAjaxManager.GetCurrent(this.Page).Alert("Adding!");
    }
 
    protected void RadGridChild2_ItemCommand(object sender, GridCommandEventArgs e)
    {
        RadAjaxManager.GetCurrent(this.Page).Alert("Adding for 2!");
    }
 
    protected void RadGridChild2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        RadGrid rg = sender as RadGrid;
        rg.AutoGenerateColumns = false;
        rg.MasterTableView.Columns.Clear();
        rg.MasterTableView.Columns.Add(new GridBoundColumn() { DataField = "DetailItemID", HeaderText = "Detail ID" });
        rg.MasterTableView.Columns.Add(new GridBoundColumn() { DataField = "ItemDetail", HeaderText = "Detail" });
        var temp = Convert.ToInt32((rg.NamingContainer as GridNestedViewItem).ParentItem.GetDataKeyValue("ItemID"));
 
        using (TestDataEntities de = new TestDataEntities())
        {
            rg.DataSource = de.Table2.Where(x => x.ItemID == temp).ToList();
        }
    }
}

When I click on the "Add Record" button on the first child grid, I get the expected alert box.
When I click on the "Add Record" button on the second child grid (dynamic), It disappears and I get nothing.

Any help is appreciated.
Princy
Top achievements
Rank 2
 answered on 09 Dec 2013
1 answer
411 views
HI,

Am in need of displaying password in the RadGrid using RadTextBox in Password TextMode. 

On Page Load, i have to fetch the record and display it in Grid. But, i cant able to display the password when it is in Password TextMode.
In fact, it is displayed in normal mode. Why it is not displaying when it is in Password Mode? Please reply me as soon as possible.
Shinu
Top achievements
Rank 2
 answered on 09 Dec 2013
1 answer
167 views
Hello.
How to align a column text to right . I want code in javascript.
Shinu
Top achievements
Rank 2
 answered on 09 Dec 2013
8 answers
226 views
Hello,

I have followed the instructions found in the Advanced Templates link that is often provided in this forum and have hit a snag. The Start Date, Start Time, End Date, and End Time don't work properly. The date and time will populate...but when you attempt to drill down a different date or time, nothing happens. Not only that, when checking or unchecking the All Day option, the time fields do not appear or disappear.

Are there any known issues with this example? Is the AdvancedForm.js file where the code for the date/time picker is? I have attached the two code snippets. One from the main aspx page that holds the radscheduler...and one from the user control that has the template code in it.

<telerik:Radscheduler ID="RadScheduler1" runat="server" DisplayDeleteConfirmation="true" 
            SelectedDate="2011-11-15" TimeZoneOffset="03:00:00" AppointmentStyleMode="Default"
             Height="" Skin="Office2007" AllowInsert="true" AllowDelete="true" EnableDescriptionField="true"
                onappointmentdelete="radSched_AppointmentDelete"
                onappointmentinsert="radSched_AppointmentInsert" 
                    StartEditingInAdvancedForm="true" StartInsertingInAdvancedForm="true"
                onappointmentupdate="radSched_AppointmentUpdate"   OnClientFormCreated="radSched_ClientFormCreated">
            <TimelineView UserSelectable="false" />
            <AdvancedForm Modal="true" />
            <AdvancedEditTemplate>
                <scheduler:SchedulerAdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" Subject='<%# Bind("Subject") %>'
                    Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Description='<%# Bind("Description") %>' />    
            </AdvancedEditTemplate>
            <AdvancedInsertTemplate>
                <scheduler:SchedulerAdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Insert" Subject='<%# Bind("Subject") %>'
                    Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Description='<%# Bind("Description") %>' />
            </AdvancedInsertTemplate>
            <TimeSlotContextMenuSettings EnableDefault="true" />
            <AppointmentContextMenuSettings EnableDefault="true" />
            </telerik:Radscheduler>


<ul class="rsTimePickers">
                <li class="rsTimePick">
                     <label for='<%= StartDate.ClientID %>_dateInput_text'>
                                <%= Owner.Localization.AdvancedFrom %></label>
                                <%--
                                Leaving a newline here will affect the layout, so we use a comment instead.
                                --%><telerik:RadDatePicker runat="server" ID="StartDate" CssClass="rsAdvDatePicker"
                                    Width="83px" SharedCalendarID="SharedCalendar" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'
                                    MinDate="1900-01-01">
                                    <DatePopupButton Visible="False" />
                                    <DateInput ID="DateInput2" runat="server" DateFormat='<%# Owner.AdvancedForm.DateFormat %>'
                                        EmptyMessageStyle-CssClass="riError" EmptyMessage=" " EnableSingleInputRendering="false"/>
                                </telerik:RadDatePicker>
                            <%--
                              
                            --%><telerik:RadTimePicker runat="server" ID="StartTime" CssClass="rsAdvTimePicker"
                                Width="65px" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'>
                                <DateInput ID="DateInput3" runat="server" EmptyMessageStyle-CssClass="riError" EmptyMessage=" " EnableSingleInputRendering="false" />
                                <TimePopupButton Visible="false" />
                                <TimeView ID="TimeView1" runat="server" Columns="2" ShowHeader="false" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                            </telerik:RadTimePicker>
                </li>
                <li class="rsTimePick">
                            <label for='<%= EndDate.ClientID %>_dateInput_text'>
                                <%= Owner.Localization.AdvancedTo%></label><%--
                              
                                --%><telerik:RadDatePicker runat="server" ID="EndDate" CssClass="rsAdvDatePicker"
                                    Width="83px" SharedCalendarID="SharedCalendar" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'
                                    MinDate="1900-01-01">
                                    <DatePopupButton Visible="False" />
                                    <DateInput ID="DateInput4" runat="server" DateFormat='<%# Owner.AdvancedForm.DateFormat %>'
                                        EmptyMessageStyle-CssClass="riError" EmptyMessage=" " EnableSingleInputRendering="false"/>
                                </telerik:RadDatePicker>
                            <%--
                              
                            --%><telerik:RadTimePicker runat="server" ID="EndTime" CssClass="rsAdvTimePicker"
                                Width="65px" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'>
                                <DateInput ID="DateInput5" runat="server" EmptyMessageStyle-CssClass="riError" EmptyMessage=" " EnableSingleInputRendering="false"/>
                                <TimePopupButton Visible="false" />
                                <TimeView ID="TimeView2" runat="server" Columns="2" ShowHeader="false" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                            </telerik:RadTimePicker>
                        </li>
                <li class="rsAllDayWrapper">
                    <asp:CheckBox runat="server" ID="AllDayEvent" CssClass="rsAdvChkWrap" Checked="false" />
                </li>
            </ul>
Vic
Top achievements
Rank 2
 answered on 08 Dec 2013
2 answers
235 views
Is it possible to have a drop zone for an asyncUploader inside a Radgrid in edit mode?
Any demo or sample about this?
Thanks,
Felice
Felice
Top achievements
Rank 1
 answered on 07 Dec 2013
1 answer
98 views
Good night,
   I get the same error than in the telerik demo page:

              http://demos.telerik.com/aspnet-ajax/editor/examples/filemanagers/defaultcs.aspx

When I click on Image Manager icon, the dialog opens but its very small. It only happens with Chrome browser (my version is 31.0.1650.63 m)

I attach the screenshot.

Is there any solution?
Thank you in advance
Miguel

 
A. Koster
Top achievements
Rank 1
 answered on 07 Dec 2013
1 answer
167 views
Hello,

I'm trying to set the RadListBox DataKeyField within the code behind.  When I attempt to assign the value I get the error: 

[column_name] is neither a DataColumn nor a DataRelation for table DefaultView

The value returned from the string category variable exactly matches with the column name in the [Product] table.

Here is my applicable code:

aspx
<telerik:RadListBox ID="RadListBox2" runat="server"
       Height="200"
       Width="300"
       AllowReorder="true"
       SelectionMode="Multiple"
       AllowDelete="true"
       DataSourceID="SelectedAttributes">
</telerik:RadListBox>
 
<asp:SqlDataSource ID="SelectedAttributes" runat="server"
        ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"
        SelectCommand="SELECT @catName FROM [Product] WHERE [Number] = @Number">
            <SelectParameters>
                <asp:Parameter Name="catName"  />
            </SelectParameters>
            <SelectParameters>
                <asp:ControlParameter Name="Number"
                  ControlID="tbSearch"
                  PropertyName="Text"/>
              </SelectParameters>
    </asp:SqlDataSource>



code-behind:
//Get CategoryName
SqlConnection conn1 = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ToString());
SqlCommand commDetails = new SqlCommand("SELECT CategoryFieldName FROM [AttributeCategory] WHERE CategoryID = @CatID", conn1);
 
 conn1.Open();
 commDetails.Parameters.Add("@CatID", SqlDbType.Int);
commDetails.Parameters["@CatID"].Value = (RadListView1.SelectedItems[0] as RadListViewDataItem).GetDataKeyValue("CategoryID").ToString();
object catName = (object)commDetails.ExecuteScalar();
conn1.Close();
 
string category = catName.ToString();
 
SelectedAttributes.SelectParameters["catName"].DefaultValue = category;
 
//Pass Data Keys For RadListBox2
RadListBox2.DataKeyField = category;
RadListBox2.DataSortField = category;
RadListBox2.DataTextField = category;
Jessica
Top achievements
Rank 1
 answered on 06 Dec 2013
2 answers
130 views
Hi

I wonder if anyone can shed any light on what is going on here please.

I have a grid into which I programatically add a hyperlink depending upon the value of a column in each row, like so;

public void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
  {
        if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "Parent")
        {
                    string linkValue = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["NotesLink"].ToString();
                    HyperLink hl = new HyperLink();
                    string strFunctionToCall = "ViewCheck('" + linkValue + "')";
                    hl.Attributes.Add("onClick", "return " + strFunctionToCall + ";");
                    hl.ToolTip = "Click for more info....";
                    hl.Text = linkValue;
                    hl.Font.Underline = true;
                    hl.ForeColor = Color.Blue;
                    GridDataItem item = (GridDataItem)e.Item;
                    item["NotesLink"].Controls.Add(hl);
        }
}

This works fine and pops a Telerik Window with info via a javascript function.

Within each row, I can have a button which when clicked will expand the child row, like so;

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "ShowAbstractDetails" && e.Item.OwnerTableView.Name == "Parent")
{
                GridDataItem parentRow = e.Item as GridDataItem;
                parentRow.Selected = true// Force the row to be selected
                if (parentRow.HasChildItems)   // Ignore ChildRow clicks
                {
                    // Expand selected item
                    int temp = RadGrid1.SelectedItems.Count;
                    foreach (GridDataItem item in RadGrid1.SelectedItems)   
                    {
                        if (item.Selected)
                        { item.Expanded = true; }
                        else
                        { item.Expanded = false; }
                    }
                }
}

When the child row expands, all of the hyperlinks disappear?

I clearly need to trap again to re-apply the link, but where do I do this?

Any help appreciated

Roger
Roger
Top achievements
Rank 1
 answered on 06 Dec 2013
1 answer
222 views
Hi,

Could you show me how to change the insert/update/cancel "links" into buttons? I know it can be done in custom form but I have to work an EditForm.  I also need to change the text on the button from "insert" to "save".

Sorry, I typed the subject wrong, it shouldn't say "image button", I just need a regular button with text on it.

Thank you for your help!

Helen
Helen
Top achievements
Rank 1
 answered on 06 Dec 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?