Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
140 views
Hi,

I have a scheduler bind to a web service everything is working fine, except that i'd like to add 2 features to the advanced form, by javascript, without using a custom template.

I'd like to add an event on the StartDate datepicker that changed automatically the end date with the same date.


I'd also like to check the AllDay checkbox by default.

I have done some test and nothing works, so maybe someone can help me...


To check the AllDay checkbox, I did in the OnClientFormCreated:
$telerik.$(".rsAllDayWrapper .rsAdvChkWrap input[type=checkbox]:first").click();

Result: Checkbox never checked...

To add an event on the startdate datepicker I did

function OnClientFormCreated(sender, eventArgs) {
var
startDateHtml = $telerik.$(".rsTimePickers .rsAdvDatePicker input[id$='StartDate']:first");
var startDateId = startDateHtml.attr('id');
var startDate = $find(startDateId);
startDate.get_dateInput().add_valueChanged(Test);
}

function Test(sender, arg) {
    alert('changed'); 
}

Result => When I either change the date directly in the text field or i use the picker, no event triggered

Thanks in advanced for your help

Veronica
Telerik team
 answered on 04 Aug 2010
1 answer
116 views
Hi,

I'm trying to create some autosave functionality to fire after the position of my docks change.

i have created the folowing event for the on change to fire.

internal void DockPositionChanged(object sender, DockPositionChangedEventArgs e)
        {
            RadDock dockSender = (RadDock)sender;
            int cntDocks = 0;
            int Ix = 0;
  
            dockstates = DocLayoutZone.GetRegisteredDocksState();
            cntDocks = dockstates.Count;
  
            Dictionary<string, string> myPositions = new Dictionary<string, string>();
            Dictionary<string, int> myIndices = new Dictionary<string, int>();
                          
            while (Ix < cntDocks)
            {
  
                if (dockSender.DockZoneID == dockstates[Ix].UniqueName)
                {
                    myPositions.Add(dockstates[Ix].UniqueName, e.DockZoneID);
                    myIndices.Add(dockstates[Ix].UniqueName, e.Index);
                }
                else
                {
                    myPositions.Add(dockstates[Ix].UniqueName,  dockstates[Ix].DockZoneID);
                    myIndices.Add(dockstates[Ix].UniqueName, dockstates[Ix].Index);
                }
                Ix++;
            }          
             
            Telerik.Web.UI.DockLayoutEventArgs myEvent = new DockLayoutEventArgs(myPositions, myIndices);
  
            mySaveDockLayout(sender, myEvent, dockstates);
        }
 
in mySaveDockLayout i try to save all positions to a cookie
protected void mySaveDockLayout(object sender, Telerik.Web.UI.DockLayoutEventArgs e, List<DockState> dockStates)
        {         
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string serializedPositions = serializer.Serialize(e.Positions);
            string serializedIndices = serializer.Serialize(e.Indices);
            string serializedDockStates = serializer.Serialize(dockStates);
  
            HttpCookie positionsCookie = new HttpCookie("DockLayout",
                serializer.Serialize(new string[] { serializedPositions, serializedIndices, serializedDockStates }));
  
            positionsCookie.Expires = DateTime.Now.AddYears(1);
            HttpContext.Current.Response.Cookies.Add(positionsCookie);                     
        }

and on the RadDockLayout control i call the following OnLoadDockLayout="LoadDockLayout" to load my dashboard from a cookie
internal void LoadLayout(HttpContext httpContext, DockLayoutEventArgs e, RadDockLayout dockLayout)
        {
            HttpCookie positionsCookie = httpContext.Request.Cookies["DockLayout"];
            if (!Object.Equals(positionsCookie, null))
            {
                string serializedPositionsAndIndices = positionsCookie.Value;
                if (!string.IsNullOrEmpty(serializedPositionsAndIndices))
                {
                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    string[] positionsAndIndices = serializer.Deserialize<string[]>(serializedPositionsAndIndices);
  
                    e.Positions = serializer.Deserialize<Dictionary<string, string>>(positionsAndIndices[0]);
                    e.Indices = serializer.Deserialize<Dictionary<string, int>>(positionsAndIndices[1]);
  
                    if (positionsAndIndices.Length > 2)
                    {
                        List<DockState> dockStates = serializer.Deserialize<List<DockState>>(positionsAndIndices[2]);
  
                        foreach (DockState state in dockStates)
                        {
                            RadDock dock = (RadDock)dockLayout.FindControl(state.UniqueName);
                            if (dock != null)
                            {
                                dock.Closed = state.Closed;
                                dock.Collapsed = state.Collapsed;
                                dock.Pinned = state.Pinned;
                            }
                        }
                    }
                }
            }
        }

but after i restart my project my docks are set to different dockzones and not on the one i placed them before.

Could you please shed some light on this situation?
Pero
Telerik team
 answered on 04 Aug 2010
1 answer
43 views
Hi,

   I am using a radcomobox in my project. I am binding it with my custome built function, which generates a list of various date ranges. The control is working fine in US, but in UK and Europe it behaves weirdly. Can some one suggest me, what the problem may be.

 Thanks
T. Tsonev
Telerik team
 answered on 04 Aug 2010
5 answers
150 views
I have seen somewhere that it is possible to limit of options available for the users of the editor by insert of some tags in the .aspx-file. Are a list with all option-tags available somewhere?
Rumen
Telerik team
 answered on 04 Aug 2010
1 answer
237 views
Hi,
    I'm probably trying to do something that is achieved in a better way but this is what I'm trying to do.

I have a page with several controls and grids that is used for an edit for something else. The page is populated with data from a business object and certain properties are data bound. What I'm trying to do is making changes on the page and then hit a save button which will then postback and I'll read all the data from the controls and save in one hit.

The issue I have is the grid. I'm able to remove the items in the grid client side
        function butConditionRemove_OnClick(grid) {
  
//grid is the clientid of the grid
            var MyGrid = $find(grid);
            var MasterTable = MyGrid.get_masterTableView();
            var selectedRows = MasterTable.get_selectedItems();
            for (var i = 0; i < selectedRows.length; i++) {
                var row = selectedRows[i];
                if (confirm("Are you sure you want to delete the selected entry?")) {
  
                    var table = MasterTable.get_element();
                    var rowtmp = table.rows[row.get_element().rowIndex]
                    table.deleteRow(row.get_element().rowIndex)
  
                               var dataItem = $find(rowtmp.id);
                              if (dataItem) {
                                   dataItem.dispose();
                                   Array.remove($find(grid).get_masterTableView()._dataItems, dataItem);
                            }
                               MyGrid.repaint();
  
                  
                  
                }
  
           
            }
  
         
        }

This works fine but when I click on the save button which is just posting back the grid object on the server side still has the objects I have deleted in it. Other controls on the page which I'm changing as well have the updated values so it's just the grid that does not reflect the changes I make client side.

So is there a way I can make the grid pass it's client side state back in the same way other controls do.
Nikolay Rusev
Telerik team
 answered on 04 Aug 2010
1 answer
121 views
I have a RadGrid on my page which pulls in an image name and a date related to the image.

I have also added a filter to the date field.

What I would like to do is have my Rotator display images from the RadGrid depending on what is shown.

So If someone filters the images by a date only those images will show in the RadRotator.

Is this at all possible and if so could someone help me out with a VB example preferably.

Thanks
Fiko
Telerik team
 answered on 04 Aug 2010
2 answers
550 views
Hi there,

How can i display the total grid rows in the footer ?

here is my grid, You can see there is a column "Department" I want to display the total grid rows in the footer of department column,

 

<telerik:RadGrid ID="RadGrid1" ShowFooter="true"

 

 

Width="99%" EnableLinqExpressions="false" FooterStyle-CssClass="GridColHeadNormal"

 

 

AllowSorting="True" runat="server">

 

 

 

<MasterTableView ClientDataKeyNames="KEYID">

 

 

<Columns>

 

 

 

 

<telerik:GridBoundColumn HeaderText="Employee Name" DataField="Name" UniqueName="Name"

 

 

SortExpression="Name" FilterControlWidth="130" AutoPostBackOnFilter="true"

 

 

CurrentFilterFunction="contains" ShowFilterIcon="false" />

 

 

 

<telerik:GridBoundColumn HeaderText="SSN" DataField="EMP_SSN"

 

 

UniqueName="SSN" SortExpression="EMP_SSN" FilterControlWidth="100" AutoPostBackOnFilter="true"

 

 

CurrentFilterFunction="contains" ShowFilterIcon="false" />

 

 

 

<telerik:GridBoundColumn HeaderText="Pay Period" DataField="CODE" SortExpression="CODE"

 

 

UniqueName="CODE" AutoPostBackOnFilter="true">

 

 

<FilterTemplate>

 

 

<telerik:RadComboBox ID="RadComboBoxPP" DataSourceID="SqlDataSourcePP" DataTextField="Code" Width="100"

 

 

DataValueField="Code" Height="100px" AppendDataBoundItems="true" OnClientSelectedIndexChanged="SelectedIndexChanged"

 

 

SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("Code").CurrentFilterValue %>'

 

 

runat="server">

 

 

<Items>

 

 

<telerik:RadComboBoxItem Text="All" />

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">

 

 

<script type="text/javascript">

 

 

function SelectedIndexChanged(sender,args) {

 

 

var tableView=$find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");

 

sender.value= args.get_item().get_value();

tableView.filter(

"CODE",args.get_item().get_value(),"EqualTo");

 

}

 

</script>

 

 

</telerik:RadScriptBlock>

 

 

</FilterTemplate>

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn HeaderText="Department" DataField="Department" SortExpression="Department"

 

 

UniqueName="Department" AutoPostBackOnFilter="true">

 

 

 

<FilterTemplate>

 

 

<telerik:RadComboBox ID="RadComboBoxDep" DataSourceID="SqlDataSourceDepartment" DataTextField="Department"

 

 

DataValueField="Department" Height="100px" AppendDataBoundItems="true" OnClientSelectedIndexChanged="SelectedIndexChanged2"

 

 

SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("Department").CurrentFilterValue %>'

 

 

runat="server">

 

 

<Items>

 

 

<telerik:RadComboBoxItem Text="All" />

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

<telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">

 

 

<script type="text/javascript">

 

 

function SelectedIndexChanged2(sender,args) {

 

 

var tableView=$find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");

 

sender.value= args.get_item().get_value();

tableView.filter(

"Department",args.get_item().get_value(),"EqualTo");

 

}

 

</script>

 

 

</telerik:RadScriptBlock>

 

 

 

</FilterTemplate>

 

 

<FooterStyle CssClass="GridColHeadNormal" />

 

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridNumericColumn Aggregate="Count" DataField="KEYID" Display="false"

 

 

UniqueName="KEYID" SortExpression="KEYID" ShowFilterIcon="false" AllowFiltering="false" />

 

 

</Columns>

 

 

</MasterTableView>

 

 

<ClientSettings >

 

 

 

 

<ClientEvents OnGridCreated="GridCreated" OnRowSelected="RowSelected" />

 

 

</ClientSettings>

 

 

 

</telerik:RadGrid>

 

Kiran
Top achievements
Rank 1
 answered on 04 Aug 2010
3 answers
315 views
When I click on a date in the scheduler control, I get the "String was not recognized as a valid DateTime" exception. Please see the two images attached for more info. I have tried changing the globalization settings on the web.config and on the IIS to en-GB. Still doesn't work. Please help.

Thanks
Veronica
Telerik team
 answered on 04 Aug 2010
3 answers
176 views
Hi All,

           Thank you very much for the support you people are provoding.Now I am here with another problem of recurrence editor
I want to hide End after  radio button and numeric Text box for entering occurrence and the text 'Occurrence' itself .I was able to hide the radio button and Numeric text box but can't hide the text 'occurrences' .Pls tell me how can I hide the text occurrence its really urgent .hope that U understand the issue .All theses are in the recurrencerange panel of recurrence editor

Thanks and Regards
Vishnu.B.R
Veronica
Telerik team
 answered on 04 Aug 2010
1 answer
123 views

 

dear sir,
RecurrenceRule
rrule = Telerik.Web.UI.RecurrenceRule.TryParse(lvl_recurringsms[0].Recurrenceinfo);

 

 

foreach (DateTime occurrence in rrule.Occurrences)

 

{

 

Console.WriteLine("\t{0}", occurrence);

 

}

 

How to filter the occurences here. Need of syntax and methods (predicate T souce)

 

rrule.Occurrences.Where<T predicate

>

Kind regards.
Arockiasamy.I

 

Veronica
Telerik team
 answered on 04 Aug 2010
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?