Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
134 views
Hi

I am very new to the RadControls. Just a few hours in fact so go easy on me. :)

I am running what seems to be an excellent tutorial here.

Advanced ASP.NET AJAX RadScheduler Customization

At around the 38 minute mark he is using code from the Templates documentation page to demo how to set the InlineInsertTemplate on the RadScheduler.

That code looks like this.

 
<telerik:RadScheduler . . . (removed the rest of this for brevity)
            <InlineInsertTemplate>
                <p>In here</p>
                <div id="InlineInsertTemplate">
                    <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Subject") %>'                                   Width="90%"
                                  TextMode="MultiLine" Height="20px"></
asp:TextBox>
                    <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert">
                        <asp:Image runat="server" ID="insertImage" ImageUrl="Images/ok.gif" AlternateText="insert" />
                    </asp:LinkButton>
                    <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel">
                        <asp:Image runat="server" ID="Image2" ImageUrl="Images/cancel.gif" AlternateText="cancel" />
                    </asp:LinkButton>
                    <div class="inline-label">
                        Color code:</div>
                  <br>
                    <asp:LinkButton ID="InsertMoreButton" runat="server" CommandName="More" CssClass="rsAdvancedEditLink">Edit Advanced</asp:LinkButton>
                </div>
            </InlineInsertTemplate><br>
</
telerik:RadScheduler>


However, when I run my RadScheduler, the Insert Template looks exactly as it did before I tried this code above.  As you can see above, I added a simple <p>In here</p> to the top of the template to see if it is displayed. It is not. Seems the RadScheduler ignores the InlineInsertTemplate

What am I missing here?
Brad
Top achievements
Rank 1
 answered on 06 Jan 2011
1 answer
106 views
Hi All,

I want to filter with multiple columns at once when click on comment button.

The program work fine if I'm not choice function on filter icon and just type in filtercontrols on columns then click comment button("Search").

The problem is when I choice filter function at one column it automatically postback and do searching, it's mean search one by one column.

1. The question is can I disable autopost to filtericon?
2. If can do disable, How to read filterfunction(that I have choose from every column) when I click on commentbutton to search?

Thanks and best regards.
Naunton
Top achievements
Rank 1
 answered on 06 Jan 2011
1 answer
122 views
I am using RadDateTimePicker. I have set a mindate and maxdate. Also it shows todays date. When I open the calender it shows the month of mindate. How do I get it to open current month. In .cs file,

((

RadDateTimePicker)this.FindControl("FromDatePicker")).SelectedDate = DateTime.Now;

 

 Is not working.

<telerik:GridBoundColumn DataField="DateCreated" HeaderText="Date Created"  
            UniqueName="DateCreated" FilterListOptions="VaryByDataTypeAllowCustom">
            <FilterTemplate>
                        From
                        <telerik:RadDateTimePicker ID="FromDatePicker" runat="server" Width="185px" Skin="WebBlue" DateInput-EmptyMessage="MinDate"
                            MinDate="01-01-2010" MaxDate="12-31-2011"  DbSelectedDate='<%# startDate1 %>'>
                            <TimeView ID="TimeView1" OnClientTimeSelected="DateSelected" runat="server">
                            </TimeView>
                             <ClientEvents OnDateSelected="DateSelected1" OnPopupOpening="PopupOpening" />
                             <Calendar runat="server"
                             <SpecialDays> <telerik:RadCalendarDay Repeatable ="Today" ItemStyle-BackColor="Red"
                             </telerik:RadCalendarDay></SpecialDays>
                             </Calendar>
                        </telerik:RadDateTimePicker>
                        to
                        <telerik:RadDateTimePicker ID="ToDatePicker" runat="server" Width="185px" MinDate="01-01-2010" Skin="WebBlue" DateInput-EmptyMessage="MinDate"
                            MaxDate="12-31-2011"  DbSelectedDate='<%# endDate1 %>'>
                            <TimeView ID="TimeView2" OnClientTimeSelected="DateSelected" runat="server" >
                            </TimeView>
                             <ClientEvents OnDateSelected="DateSelected1"  OnPopupOpening="PopupOpening" />
                             <Calendar ID="Calendar1" runat="server">
                             <SpecialDays> <telerik:RadCalendarDay Repeatable ="Today" ItemStyle-BackColor="Red">   
                             </telerik:RadCalendarDay></SpecialDays>
                             </Calendar>
                        </telerik:RadDateTimePicker>
                        <telerik:RadScriptBlock ID="RadScriptBlock111" runat="server">
  
                            <script type="text/javascript">
                                function DateSelected(sender, args) {
                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                    tableView.filter("DateCreated", "", "Between");
                                }
                                var isDateToBeSet = true;
                                function DateSelected1(sender, args) {
                                    if (isDateToBeSet) {
                                        sender.get_timeView().setTime(00, 01, 0, null);
                                    }
                                }
                                function PopupOpening(sender, args) {
                                    isDateToBeSet = args.get_popupControl().get_id().indexOf("timeView") != -1 ? false : true;
  
                                }
                            </script> </telerik:RadScriptBlock>
                    </FilterTemplate>
            <HeaderStyle Font-Bold="True" />
            <ItemStyle Width="31%" />
        </telerik:GridBoundColumn>
Please help.
Shinu
Top achievements
Rank 2
 answered on 06 Jan 2011
1 answer
93 views
I am using GridClientSelectColumn and I have to call ClientEvents on checkbox click not onRowSelected.

<ClientEvents OnRowSelected="onSelected" OnRowDeselected="OnDeselected" />

Client events takes two arguments sender, args. If i add attribute on checkbox on server side then how can i pass (sender, args) parametes to get  args._dataKeyValues.

GridDataItem dataitem = (GridDataItem)e.Item;
CheckBox checkbox = (CheckBox)dataitem["column"].Controls[0];
checkbox.Attributes.Add("onclick", "onselect()");

How can i do this?
Princy
Top achievements
Rank 2
 answered on 06 Jan 2011
1 answer
179 views
I  have a complex scenario where I have a RadGrid that contains a GridTableView, and that GridTableView needs a RadComboBox in the CommandItemTemplate whose item list needs to load dynamically based on the selected item in the parent grid.  When an item is selected in the combo, it needs to insert a record into the GridTableView.  The grid looks something like:

<telerik:RadGrid ID="MeetingRoomsGrid" runat="server" OnDetailTableDataBind="MeetingRoomsGrid_DetailTableDataBind">
    <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="Id" EditMode="InPlace" InsertItemPageIndexAction="ShowItemOnFirstPage">
        <CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true" ShowExportToPdfButton="true" ShowExportToCsvButton="true" />
        <DetailTables>
            <telerik:GridTableView DataKeyNames="Id" Name="Aggregates" Width="100%" AllowSorting="true" AllowFilteringByColumn="true" CommandItemDisplay="Top">
                <CommandItemTemplate>
                    <div style="float: right;">
                        <telerik:RadComboBox  ID="AggregateRoomCombo" runat="server" AutoPostBack="true" OnSelectedIndexChanged="AggregateRoomCombo_SelectedIndexChanged">
                            <Items>
                                <telerik:RadComboBoxItem Text="foo" />
                                <telerik:RadComboBoxItem Text="bar" />
                            </Items>
                        </telerik:RadComboBox>

                    </div>
                    <div class="clearfix">&nbsp;</div>
                </CommandItemTemplate>
                <Columns>
                    <telerik:GridBoundColumn DataField="ChildName" DataType="System.String" UniqueName="ChildName" SortExpression="ChildName" />
                    <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" ButtonType="ImageButton">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
        <Columns>
            <telerik:GridEditCommandColumn UniqueName="EditColumn" ButtonType="ImageButton">
                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
            </telerik:GridEditCommandColumn>
            <telerik:GridTemplateColumn DataField="Name"
                DataType="System.String"
                UniqueName="Name"
                SortExpression="Name"
                DefaultInsertValue="New Meeting Room"
                ItemStyle-Width="210">
                <ItemTemplate>
                    <asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Name") %>' />
                </ItemTemplate>
           </telerik:GridTemplateColumn>
       </Columns>
    </MasterTableView>
</telerik:RadGrid>

(I have stripped out a bunch of stuff to try to pare it down to the essential essence)

So on the MeetingRoomsGrid_DetailDataBind() event I need to find the AggregateRoomCombo and load items into it based on the Id of the selected data item in the grid, and on the AggregateRoomCombo_SelectedIndexChanged() event I need to insert a new record into the detail table based on the Id of the selected data item in the grid.

Can anyone tell me how to traverse the grid object model to 1) find the AggregateRoomCombo object in the detail table, and 2) traverse backwards from the AggregateRoomCombo up to the grid to find the Id of the selected data item?
Ron Miles
Top achievements
Rank 1
 answered on 06 Jan 2011
4 answers
169 views
I am using the RadEditor in the admin section of an application that uses ASP.NET 4 routing. I am having some problems getting the editor to work correctly with the routes. I have made some progress resolving the problems following the instructions in this blog post: http://www.scottfindlater.co.uk/blog/net-4-routing-and-telerik-editor-dialogue-handlers, however, I still get the following error when I attempt to access any of the resource manager dialogues (eg ImageManager). Please can you tell me what is causing the problem and how to solve it. Details of Editor implementation below the error trace.

Exception Trace
[TypeAccessException: Attempt by method 'DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure)' to access type 'Telerik.Web.UI.GridDataTableFromEnumerable+GridGenericEnumerable`1<System.Data.DataRowView>' failed.]
lambda_method(Closure ) +22
System.Linq.EnumerableExecutor`1.Execute() +94
System.Linq.EnumerableExecutor`1.ExecuteBoxed() +23
System.Linq.EnumerableQuery`1.System.Linq.IQueryProvider.Execute(Expression expression) +94
Telerik.Web.UI.GridDynamicQueryable.Count(IQueryable source) +143
Telerik.Web.UI.GridDataTableFromEnumerable.FillData35() +216
Telerik.Web.UI.GridDataTableFromEnumerable.FillData() +758
Telerik.Web.UI.GridResolveEnumerable.Initialize() +35
Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +24
Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, DataView dataView, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +203
Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +76
Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +98
Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +151
Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +33
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +66
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +128
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
Telerik.Web.UI.GridTableView.PerformSelect() +4
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
Telerik.Web.UI.GridTableView.DataBind() +259
Telerik.Web.UI.RadGrid.DataBind() +87
Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +2342
Telerik.Web.UI.RadGrid.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146

RadGrid use in page:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

        <telerik:RadEditor ID="editContent" runat="server">
        </telerik:RadEditor>

Skin file:
<telerik:RadEditor runat="server" Width="100%" DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.aspx" />

Programatic configuration of editor in codebehind:

        Private Sub SetupPage()
            editContent.MediaManager.ViewPaths = New String() {Config.MediaDirectory}
            editContent.MediaManager.UploadPaths = New String() {Config.MediaDirectory}
            editContent.MediaManager.DeletePaths = New String() {Config.MediaDirectory}
            editContent.ImageManager.ViewPaths = New String() {Config.ImageDirectory}
            editContent.ImageManager.UploadPaths = New String() {Config.ImageDirectory}
            editContent.ImageManager.DeletePaths = New String() {Config.ImageDirectory}
            editContent.FlashManager.ViewPaths = New String() {Config.FlashDirectory}
            editContent.FlashManager.UploadPaths = New String() {Config.FlashDirectory}
            editContent.FlashManager.DeletePaths = New String() {Config.FlashDirectory}
            editContent.DocumentManager.ViewPaths = New String() {Config.DownloadDirectory}
            editContent.DocumentManager.UploadPaths = New String() {Config.DownloadDirectory}
            editContent.DocumentManager.DeletePaths = New String() {Config.DownloadDirectory}
            Dim templateDirectory As String = String.Format("{0}/Editor", Config.TemplateDirectory)
            editContent.TemplateManager.ViewPaths = New String() {templateDirectory}
            editContent.TemplateManager.UploadPaths = New String() {templateDirectory}
            editContent.TemplateManager.DeletePaths = New String() {templateDirectory}
        End Sub
Paul Taylor
Top achievements
Rank 1
 answered on 05 Jan 2011
1 answer
109 views

Greetings,

I am able to get a reference to the radGrid,

 

But in the VS Immediate Window:

 

 

radGrid.MasterTableView.Items.count

 

returns zero,

but I have several rows of data in grid.

On Postback what am I missing here?

 

Thanks

 

Dave G / Ft. Worth Tx.



   protected void btnNext_Click(object sender, ImageClickEventArgs e)

        {

 

 

 

            RadGrid radGrid = FindControl("rdTinExcel") as RadGrid;

 

            foreach (GridDataItem dataItem in radGrid.MasterTableView.Items) 

           {

 

                // push Rowa that are not Checked in the Grid  

                if (!(dataItem.FindControl("cbSelectColumn") as CheckBox).Checked)

                {

 

Do something here…..

 

}

Todd Anglin
Top achievements
Rank 2
 answered on 05 Jan 2011
2 answers
141 views
I have a RadListBox with checkboxes.  I would like the user to be able to select an item in the listbox and click on an Edit link to open up a popup in which the user can edit the information based on the selected item.  So I need to pass the selected value as an id (key) in the LoadContentFrom on my Telerik Window.  I am not sure as to how to do this.  I tried creating a hidden field and setting it using the OnClientItemChecked, but I am having difficulty actually getting the selected item and its value.  The listbox is not being found - please see the code below.

    <script language="javascript" type="text/javascript">
  
        function setSelectedUser() {
            var listBox = $find('<%= UsersLB.ClientID %>_ClientState');
            var selectedItem = listBox.get_selectedItem();
            document.getElementById("selectedUser").value = selectedItem.get_value());
        }
    </script>
    <%  UsersLB.DataSource = Model.userList
        UsersLB.DataValueField = "Value"
        UsersLB.DataTextField = "Text"
        UsersLB.DataBind()
          
        UserGroupsLB.DataSource = Model.userGroupList
        UserGroupsLB.DataValueField = "Value"
        UserGroupsLB.DataTextField = "Text"
        UserGroupsLB.DataBind()
    %>
    <div id="mainright">
        <asp:HiddenField ID="selectedUser" runat="server"/>
        <div>
            <telerik:RadListBox ID="UsersLB" runat="server" CheckBoxes="true" Height="300px" OnClientItemChecked="setSelectedUser()">
            </telerik:RadListBox>
            <a href="#" id="newUser">New</a>       <a href="#" id="editUser">Edit</a>
            <%  Html.Telerik().Window().Name("CreateWindow") _
                .LoadContentFrom("Create", "User") _
                .Buttons(Function(buttons) buttons.Refresh().Maximize().Close()) _
                .Draggable(True) _
                .Height(450) _
                .Width(500) _
                .Resizable() _
                .Title("Create New GMC Web User") _
                .HtmlAttributes(New With {.class = "windows7"}) _
                .Visible(False) _
                .Render()
             %>
            <%  Html.Telerik().Window().Name("EditWindow") _
                .LoadContentFrom("Edit", "User") _
                .Buttons(Function(buttons) buttons.Refresh().Maximize().Close()) _
                .Draggable(True) _
                .Height(450) _
                .Width(500) _
                .Resizable() _
                .Title("Edit GMC Web User") _
                .HtmlAttributes(New With {.class = "windows7"}) _
                .Visible(False) _
                .Render()
             %>
        </div>
        <div>
            <telerik:RadListBox ID="UserGroupsLB" runat="server" CheckBoxes="true" Height="300px">
            </telerik:RadListBox>
        </div>
  
    </div>
    <%  Html.Telerik().ScriptRegistrar().OnDocumentReady("$('#newUser').bind('click', function openWindow(e){ $('#CreateWindow').data('tWindow').center().open().refresh();})")
            .OnDocumentReady("$('#editUser').bind('click', function openWindow(e){$('#EditWindow').data('tWindow').center().open()>refresh();})")
%>


 Can you please point me in the right direction as to how to do what I need?

Thank you very much,
Donna
Donna Stewart
Top achievements
Rank 1
 answered on 05 Jan 2011
3 answers
253 views
I'm using Version=2009.3.1314.35 because the latest version seems to mess up my grid skins which I don't feel like dealing with right now.

Anyway in this version, is there an easy way to show an excel icon like in the latest? Something like showExcelIcon = true?

Also, if I don't supply a command item template, a default one renders with input elements of type submit with <a> tags.
Is there an example of how I can do this manually in the command item template?
If I just put an input element in the command item template and set runat to server, it doesn't get acknowledged by the Command Item clicked event like link buttons do. 
How do I successfully implement my own <a> tag for an input element in the command item template?

I need something like the following but i'm confused by the autogenerated $ctl00$ctl02$ctl00$ text
<a href="javascript:__doPostBack('InactiveUnitGrid$ctl00$ctl02$ctl00$RebindGridButton','')" id="InactiveUnitGrid_ctl00_ctl02_ctl00_RebindGridButton">Refresh</a>

What is this RebindGridButton that gets referenced in the doPostBack method?
Should I be able to just reference the RebindGridButton without the InactiveUnitGrid_ctl00_ctl02_ctl00_ prefix? 
Matt
Top achievements
Rank 1
 answered on 05 Jan 2011
2 answers
530 views

I am trying to add an .net button dynamically to the radgrid footer with the following code.  The button gets displayed correctly.
However, the btn_Click event does not get fired when the button is clicked.
Am I missing something in the code?

Thanks for your help.

  protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
{  
        if (e.Item is GridFooterItem)  
        {  
            GridFooterItem footerItem = (GridFooterItem)e.Item;  
            RadScriptManager1.RegisterAsyncPostBackControl(btn);
            Button btn = new Button();  
            btn.Text = "Button";  
            btn.Click += new System.EventHandler(btn_Click);
            footerItem.Cells[2].Controls.Add(btn);  
        }  
    }  

weezie
Top achievements
Rank 1
 answered on 05 Jan 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?